Skip to content

Commit

Permalink
try to fix get site-paclages folder for ubutnu
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Mar 28, 2024
1 parent 5c30574 commit 2ed9b9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ def get_site_package_folder(self):
def find_lib_folder(self, lib_name:str):
dirs = [f for f in os.listdir(self.get_site_package_folder()) if f.startswith(lib_name.replace('-', '_')+'-')]
if len(dirs) == 1:
for f in os.listdir(os.join(self.get_site_package_folder(),dirs[0])):
for f in os.listdir(os.path.join(self.get_site_package_folder(),dirs[0])):
print(f"file in dir: {f}")
return dirs[0]
return os.path.join(self.get_site_package_folder(), dirs[0])
return None

def get_installed_lib_version(self, lib_name:str):

dir_name = self.find_lib_folder(lib_name)
if dir_name:
metadata_file = os.path.join(sys.exec_prefix, 'Lib', 'site-packages', dir_name, 'METADATA')
metadata_file = os.path.join(dir_name, 'METADATA')
with open(metadata_file, 'r') as f:
for l in f.readlines():
if l.startswith('Version: '):
Expand Down

0 comments on commit 2ed9b9d

Please sign in to comment.