Skip to content

Commit cb614c8

Browse files
committed
get_packages check top_level.txt
1 parent 2906682 commit cb614c8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

dongtai_agent_python/utils/utils.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,12 @@ def get_packages():
8989
if os.path.exists(module_path):
9090
found = True
9191

92-
if not found:
93-
try:
94-
top_level = package.get_metadata('top_level.txt').splitlines()
95-
if top_level:
96-
for lvl in top_level:
97-
if os.path.exists(package.location + os.sep + lvl):
98-
module_path = package.location + os.sep + lvl
99-
except Exception:
100-
module_path = package.location + os.sep + package.project_name.lower()
92+
if not found and package.has_metadata('top_level.txt'):
93+
top_level = package.get_metadata('top_level.txt').splitlines()
94+
if top_level:
95+
for lvl in top_level:
96+
if os.path.exists(package.location + os.sep + lvl):
97+
module_path = package.location + os.sep + lvl
10198

10299
sha_1 = hashlib.sha1()
103100
sha_1.update(bytes(package.project_name.lower() + '-' + package.version, encoding='utf-8'))

0 commit comments

Comments
 (0)