mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 05:31:31 +00:00
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:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# ***********************IMPORTANT NMAP LICENSE TERMS************************
|
||||
# * *
|
||||
@@ -59,8 +58,8 @@
|
||||
# ***************************************************************************/
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] != 2:
|
||||
sys.exit("Sorry, Zenmap requires Python 2")
|
||||
if sys.version_info[0] != 3:
|
||||
sys.exit("Sorry, Zenmap requires Python 3")
|
||||
|
||||
import errno
|
||||
import os
|
||||
@@ -127,7 +126,7 @@ data_files = [
|
||||
]
|
||||
|
||||
# Add i18n files to data_files list
|
||||
os.path.walk(locale_dir, mo_find, data_files)
|
||||
os.walk(locale_dir, mo_find, data_files)
|
||||
|
||||
|
||||
# path_startswith and path_strip_prefix are used to deal with the installation
|
||||
@@ -213,7 +212,7 @@ class my_install(install):
|
||||
self.install_scripts, "uninstall_" + APP_NAME)
|
||||
|
||||
uninstaller = """\
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
import errno, os, os.path, sys
|
||||
|
||||
print 'Uninstall %(name)s %(version)s'
|
||||
@@ -266,7 +265,7 @@ for file in files:
|
||||
print "Removing '%s'." % file
|
||||
try:
|
||||
os.remove(file)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
print >> sys.stderr, ' Error: %s.' % str(e)
|
||||
# Delete the directories. First reverse-sort the normalized paths by
|
||||
# length so that child directories are deleted before their parents.
|
||||
@@ -276,7 +275,7 @@ for dir in dirs:
|
||||
try:
|
||||
print "Removing the directory '%s'." % dir
|
||||
os.rmdir(dir)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOTEMPTY:
|
||||
print "Directory '%s' not empty; not removing." % dir
|
||||
else:
|
||||
@@ -288,7 +287,7 @@ for dir in dirs:
|
||||
uninstaller_file.close()
|
||||
|
||||
# Set exec bit for uninstaller
|
||||
mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0555) & 07777
|
||||
mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0o555) & 0o7777
|
||||
os.chmod(uninstaller_filename, mode)
|
||||
|
||||
def set_modules_path(self):
|
||||
@@ -442,7 +441,7 @@ class my_uninstall(Command):
|
||||
# Read the list of installed files.
|
||||
try:
|
||||
f = open(INSTALLED_FILES_NAME, "r")
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
log.error("Couldn't open the installation record '%s'. "
|
||||
"Have you installed yet?" % INSTALLED_FILES_NAME)
|
||||
@@ -465,7 +464,7 @@ class my_uninstall(Command):
|
||||
try:
|
||||
if not self.dry_run:
|
||||
os.remove(file)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
log.error(str(e))
|
||||
# Delete the directories. First reverse-sort the normalized paths by
|
||||
# length so that child directories are deleted before their parents.
|
||||
@@ -476,7 +475,7 @@ class my_uninstall(Command):
|
||||
log.info("Removing the directory '%s'." % dir)
|
||||
if not self.dry_run:
|
||||
os.rmdir(dir)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOTEMPTY:
|
||||
log.info("Directory '%s' not empty; not removing." % dir)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user