Skip to content

Commit f5f4958

Browse files
Update code_report.py (#42838)
* Update code_report.py * Improve package directory resolution logic * Improve package directory resolution logic Refactor package resolution to check for both setup.py and pyproject.toml files.
1 parent ce9d767 commit f5f4958

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

eng/tools/azure-sdk-tools/packaging_tools/code_report.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ def create_report_from_func(function_attr):
186186

187187
# given an input of a name, we need to return the appropriate relative diff between the sdk_root and the actual package directory
188188
def resolve_package_directory(package_name):
189-
packages = [
190-
os.path.dirname(p)
191-
for p in (glob.glob("{}/setup.py".format(package_name)) + glob.glob("sdk/*/{}/setup.py".format(package_name)))
192-
]
189+
for install_file in ["setup.py", "pyproject.toml"]:
190+
packages = [
191+
os.path.dirname(p)
192+
for p in (glob.glob("{}/{}".format(package_name, install_file)) + glob.glob("sdk/*/{}/{}".format(package_name, install_file)))
193+
]
194+
if packages:
195+
break
193196

194197
if len(packages) > 1:
195198
print(

0 commit comments

Comments
 (0)