python3-openEuler 0.0.4__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of python3-openEuler might be problematic. Click here for more details.
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/PKG-INFO +1 -1
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/openEuler/openEuler.py +33 -27
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/PKG-INFO +1 -1
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/setup.py +1 -1
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/LICENSE +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/README.md +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/openEuler/__init__.py +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/SOURCES.txt +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/dependency_links.txt +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/requires.txt +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/top_level.txt +0 -0
- {python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/setup.cfg +0 -0
|
@@ -147,36 +147,42 @@ class OpenEuler():
|
|
|
147
147
|
|
|
148
148
|
def __replace_macros(self,value, macros):
|
|
149
149
|
"""根据宏字典替换字符串中的宏."""
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
if not macros:
|
|
151
|
+
return value
|
|
152
|
+
|
|
153
|
+
# 预编译所有宏的正则表达式,提升效率
|
|
154
|
+
patterns = [
|
|
155
|
+
(re.compile(re.escape(key)), val)
|
|
156
|
+
for key, val in macros.items()
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
prev_value = None
|
|
160
|
+
current_value = value
|
|
161
|
+
# 循环替换直到无变化(处理嵌套宏)
|
|
162
|
+
while current_value != prev_value:
|
|
163
|
+
prev_value = current_value
|
|
164
|
+
for pattern, replacement in patterns:
|
|
165
|
+
try:
|
|
166
|
+
current_value = pattern.sub(replacement, current_value)
|
|
167
|
+
except Exception as e:
|
|
168
|
+
continue
|
|
169
|
+
return current_value
|
|
170
|
+
|
|
158
171
|
|
|
159
172
|
def __extract_macros(self,spec):
|
|
160
|
-
macros =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
macros[k] = w
|
|
173
|
+
macros = dict(spec.macros)
|
|
174
|
+
|
|
175
|
+
# 补充必要的默认宏(若不存在)
|
|
176
|
+
macros.setdefault("name", spec.name)
|
|
177
|
+
macros.setdefault("version", spec.version)
|
|
178
|
+
macros.setdefault("release", spec.release)
|
|
179
|
+
|
|
180
|
+
# 补充全局默认宏(若不存在)
|
|
181
|
+
for key, default_val in DEFAULT_MACROS.items():
|
|
182
|
+
macros.setdefault(key, default_val)
|
|
183
|
+
|
|
172
184
|
return macros
|
|
173
185
|
|
|
174
|
-
def __get_spec_files(self,root_path):
|
|
175
|
-
spec_files = []
|
|
176
|
-
for elem in Path(root_path).glob("**/*"):
|
|
177
|
-
if Path(elem).is_file() and elem.name.endswith(".spec"):
|
|
178
|
-
spec_files.append(elem)
|
|
179
|
-
return spec_files
|
|
180
186
|
|
|
181
187
|
def __get_rpm_list_from_spec(self,spec_file):
|
|
182
188
|
"""从 RPM spec 文件中提取所有包名并替换宏。"""
|
|
@@ -201,7 +207,7 @@ class OpenEuler():
|
|
|
201
207
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
202
208
|
git.Repo.clone_from(repo_url, temp_dir, branch=branch, depth=1)
|
|
203
209
|
log.info(f"clone {repo_name} success")
|
|
204
|
-
spec_files =
|
|
210
|
+
spec_files = list(Path(temp_dir).rglob("*.spec"))
|
|
205
211
|
|
|
206
212
|
for spec_file in spec_files:
|
|
207
213
|
temp_list = self.__get_rpm_list_from_spec(spec_file)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python3_openeuler-0.0.4 → python3_openeuler-0.0.6}/python3_openEuler.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|