Merge #2088: Update Zenmap to Python 3 and PyGObject

Note: Ndiff build will be broken until subsequent changes are made.
Deprecation warnings will need to be addressed in future changes.
Closes #2088
This commit is contained in:
dmiller 2022-12-07 20:34:03 +00:00
parent e2e55660c3
commit 24b26317c7
104 changed files with 5381 additions and 4383 deletions

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
# ***********************IMPORTANT NMAP LICENSE TERMS************************
# * *
@ -66,7 +65,7 @@ import os.path
import sys
import shutil
from zenmapCore.BasePaths import base_paths, fs_dec
from zenmapCore.BasePaths import base_paths
from zenmapCore.Name import APP_NAME
@ -79,14 +78,14 @@ def get_prefix():
frozen = getattr(sys, "frozen", None)
if frozen == "macosx_app" or "Zenmap.app" in sys.executable:
# A py2app .app bundle.
return os.path.join(dirname(fs_dec(sys.executable)), "..", "Resources")
return os.path.join(dirname(sys.executable), "..", "Resources")
elif frozen is not None:
# Assume a py2exe executable.
return dirname(fs_dec(sys.executable))
return dirname(sys.executable)
else:
# Normal script execution. Look in the current directory to allow
# running from the distribution.
return os.path.abspath(os.path.dirname(fs_dec(sys.argv[0])))
return os.path.abspath(os.path.dirname(sys.argv[0]))
prefix = get_prefix()
@ -182,7 +181,7 @@ def create_dir(path):
directory already exists."""
try:
os.makedirs(path)
except OSError, e:
except OSError as e:
if e.errno != errno.EEXIST:
raise
@ -224,19 +223,19 @@ def return_if_exists(path, create=False):
Path = Paths()
if __name__ == '__main__':
print ">>> SAVED DIRECTORIES:"
print ">>> LOCALE DIR:", Path.locale_dir
print ">>> PIXMAPS DIR:", Path.pixmaps_dir
print ">>> CONFIG DIR:", Path.config_dir
print
print ">>> FILES:"
print ">>> USER CONFIG FILE:", Path.user_config_file
print ">>> CONFIG FILE:", Path.user_config_file
print ">>> TARGET_LIST:", Path.target_list
print ">>> PROFILE_EDITOR:", Path.profile_editor
print ">>> SCAN_PROFILE:", Path.scan_profile
print ">>> RECENT_SCANS:", Path.recent_scans
print ">>> OPTIONS:", Path.options
print
print ">>> DB:", Path.db
print ">>> VERSION:", Path.version
print(">>> SAVED DIRECTORIES:")
print(">>> LOCALE DIR:", Path.locale_dir)
print(">>> PIXMAPS DIR:", Path.pixmaps_dir)
print(">>> CONFIG DIR:", Path.config_dir)
print()
print(">>> FILES:")
print(">>> USER CONFIG FILE:", Path.user_config_file)
print(">>> CONFIG FILE:", Path.user_config_file)
print(">>> TARGET_LIST:", Path.target_list)
print(">>> PROFILE_EDITOR:", Path.profile_editor)
print(">>> SCAN_PROFILE:", Path.scan_profile)
print(">>> RECENT_SCANS:", Path.recent_scans)
print(">>> OPTIONS:", Path.options)
print()
print(">>> DB:", Path.db)
print(">>> VERSION:", Path.version)