1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

Remove unneeded use of deprecated imp module

This commit is contained in:
dmiller
2023-03-17 16:51:38 +00:00
parent 490f5bb7c7
commit 5fd12db129

View File

@@ -57,7 +57,6 @@
# * *
# ***************************************************************************/
import imp
import os
import signal
import sys
@@ -135,14 +134,6 @@ def new_window():
return w
# Script found at
# http://www.py2exe.org/index.cgi/HowToDetermineIfRunningFromExe
def main_is_frozen():
return (hasattr(sys, "frozen") # new py2exe
or hasattr(sys, "importers") # old py2exe
or imp.is_frozen("__main__")) # tools/freeze
def is_root():
if 'NMAP_PRIVILEGED' in os.environ:
return True
@@ -319,16 +310,8 @@ Do this now? \
if target and profile:
page.start_scan_cb()
if main_is_frozen():
# This is needed by py2exe
Gdk.threads_init()
Gdk.threads_enter()
Gtk.main()
if main_is_frozen():
Gdk.threads_leave()
class NonRootWarning (HIGAlertDialog):
def __init__(self):
@@ -339,3 +322,6 @@ Some %s options need root privileges to work.''') % (
HIGAlertDialog.__init__(self, message_format=_('Non-root user'),
secondary_text=warning_text)
if __name__ == "__main__":
run()