Skip to content

Commit

Permalink
Fix failure to find zenmap translations
Browse files Browse the repository at this point in the history
Installation of translations hasn't worked since the conversion to
Python 3 (#2088). That's because os.walk is not a drop-in replacement
for os.path.walk. This tweak to setup.py should address that (fixes #2718).
  • Loading branch information
pghmcfc committed Mar 1, 2024
1 parent b862961 commit a8f37ef
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions zenmap/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@
desktop_dir = os.path.join('share', 'applications')


def mo_find(result, dirname, fnames):
files = []
for f in fnames:
p = os.path.join(dirname, f)
if os.path.isfile(p) and f.endswith(".mo"):
files.append(p)
def mo_find(dirname, result):
for (root, dirs, files) in os.walk(locale_dir):
mo_files = []
for f in files:
p = os.path.join(root, f)
if os.path.isfile(p) and f.endswith(".mo"):
mo_files.append(p)

if files:
result.append((dirname, files))
if mo_files:
result.append((root, mo_files))

###############################################################################
# Installation variables
Expand All @@ -124,7 +125,7 @@ def mo_find(result, dirname, fnames):
]

# Add i18n files to data_files list
os.walk(locale_dir, mo_find, data_files)
mo_find(locale_dir, data_files)


# path_startswith and path_strip_prefix are used to deal with the installation
Expand Down

0 comments on commit a8f37ef

Please sign in to comment.