Skip to content

Commit e8918b0

Browse files
authored
Fix issue with broken _version parsing in ParsedSetup (#43143)
* fix issue with pulling version from wrong file
1 parent e3b5cbc commit e8918b0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def discover_namespace(package_root_path: str) -> Optional[str]:
249249

250250
def _set_root_namespace(init_file_path: str, module_name: str) -> Optional[str]:
251251
"""
252-
Examine an __init__.py file to determine if it represents a substantial namespace
252+
Examine an __init__.py file to determine if it represents a substantial namespace
253253
or is just a namespace extension file.
254254
255255
:param str init_file_path: Path to the __init__.py file
@@ -327,7 +327,7 @@ def __init__(
327327
@classmethod
328328
def from_path(cls, parse_directory_or_file: str):
329329
"""
330-
Creates a new ParsedSetup instance from a path to a setup.py, pyproject.toml (with [project] member),
330+
Creates a new ParsedSetup instance from a path to a setup.py, pyproject.toml (with [project] member),
331331
or a directory containing either of those files.
332332
"""
333333
(
@@ -373,6 +373,18 @@ def get_config_setting(self, setting: str, default: Any = True) -> Any:
373373
def is_reporting_suppressed(self, setting: str) -> bool:
374374
return compare_string_to_glob_array(setting, self.get_config_setting("suppressed_skip_warnings", []))
375375

376+
def __str__(self):
377+
lines = [f"ParsedSetup from {self.folder}"]
378+
for attr in [
379+
"name", "version", "python_requires", "requires", "is_new_sdk",
380+
"setup_filename", "namespace", "package_data", "include_package_data",
381+
"classifiers", "keywords", "ext_package", "ext_modules",
382+
"is_metapackage", "is_pyproject"
383+
]:
384+
value = getattr(self, attr)
385+
lines.append(f"\t{attr}={value}")
386+
return "\n".join(lines)
387+
376388

377389
def update_build_config(package_path: str, new_build_config: Dict[str, Any]) -> Dict[str, Any]:
378390
"""
@@ -693,7 +705,7 @@ def get_version_py(setup_path: str) -> Optional[str]:
693705

694706
# Find path to _version.py recursively
695707
for root, dirs, files in os.walk(file_path):
696-
dirs[:] = [d for d in dirs if d not in EXCLUDE and not d.endswith(".egg-info")]
708+
dirs[:] = [d for d in dirs if d not in EXCLUDE and not d.endswith(".egg-info") and not d.startswith(".")]
697709

698710
if VERSION_PY in files:
699711
return os.path.join(root, VERSION_PY)

0 commit comments

Comments
 (0)