1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 08:41:34 +00:00

Zenmap: keep data files within package

This commit is contained in:
dmiller
2024-03-27 16:35:29 +00:00
parent 60a762c745
commit b41175cd6c
93 changed files with 33 additions and 44 deletions

View File

@@ -79,13 +79,16 @@
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
</binary> </binary>
<!-- Python modules other than tnese are grabbed with get_deps.py --> <!-- Python modules other than these are grabbed with get_deps.py -->
<binary> <binary>
${prefix}/lib/python&PYVER;/site-packages/gi/*.so ${prefix}/lib/python&PYVER;/site-packages/gi/*.so
</binary> </binary>
<binary> <binary>
${prefix}/lib/python&PYVER;/site-packages/cairo/*.so ${prefix}/lib/python&PYVER;/site-packages/cairo/*.so
</binary> </binary>
<data>
${prefix}/lib/python&PYVER;/site-packages/zenmapCore/data
</data>
&pyreqs; &pyreqs;

View File

@@ -26,6 +26,12 @@ zenmap = "zenmapGUI.App:run"
[tool.setuptools] [tool.setuptools]
packages = [ packages = [
"zenmapCore", "zenmapCore",
"zenmapCore.data.config",
"zenmapCore.data.docs",
"zenmapCore.data.locale",
"zenmapCore.data.misc",
"zenmapCore.data.pixmaps",
"zenmapCore.data.pixmaps.radialnet",
"zenmapGUI", "zenmapGUI",
"zenmapGUI.higwidgets", "zenmapGUI.higwidgets",
"radialnet", "radialnet",
@@ -33,16 +39,15 @@ packages = [
"radialnet.core", "radialnet.core",
"radialnet.gui", "radialnet.gui",
"radialnet.util", "radialnet.util",
"share",
] ]
[tool.setuptools.dynamic] [tool.setuptools.dynamic]
version = {attr = "zenmapCore.Version.VERSION"} version = {attr = "zenmapCore.Version.VERSION"}
[tool.setuptools.package-data] [tool.setuptools.package-data]
"share.zenmap.pixmaps" = ["*.gif", "*.png"] "zenmapCore.data.pixmaps" = ["*.gif", "*.png"]
"share.zenmap.pixmaps.radialnet" = ["*.png"] "zenmapCore.data.pixmaps.radialnet" = ["*.png"]
"share.zenmap.locale" = ["*.mo"] "zenmapCore.data.locale" = ["*.mo"]
"share.zenmap.config" = ["zenmap.conf", "scan_profile.usp", "zenmap_version"] "zenmapCore.data.config" = ["zenmap.conf", "scan_profile.usp", "zenmap_version"]
"share.zenmap.docs" = ["*.html"] "zenmapCore.data.docs" = ["*.html"]
"share.zenmap.misc" = ["*.xml"] "zenmapCore.data.misc" = ["*.xml"]

View File

@@ -76,5 +76,4 @@ base_paths = dict(user_config_file=APP_NAME + '.conf',
target_list='target_list.txt', target_list='target_list.txt',
options='options.xml', options='options.xml',
user_home=HOME, user_home=HOME,
db=APP_NAME + ".db", db=APP_NAME + ".db")
version=APP_NAME + "_version")

View File

@@ -68,38 +68,13 @@ from zenmapCore.BasePaths import base_paths
from zenmapCore.Name import APP_NAME from zenmapCore.Name import APP_NAME
# Find out the prefix under which data files (interface definition XML, prefix = join(dirname(__file__), 'data')
# pixmaps, etc.) are stored. This can vary depending on whether we are running
# in an executable package and what type of package it is, which we check using
# the sys.frozen attribute. See
# http://mail.python.org/pipermail/pythonmac-sig/2004-November/012121.html.
def get_prefix():
from site import getsitepackages
frozen = getattr(sys, "frozen", None)
if frozen == "macosx_app" or "Zenmap.app" in sys.executable:
# A py2app .app bundle.
return os.path.join(dirname(sys.executable), "..", "Resources")
elif frozen is not None:
# Assume a py2exe executable.
return dirname(sys.executable)
elif any(__file__.startswith(pdir) for pdir in getsitepackages()):
# Installed in site-packages; use configured prefix.
return sys.prefix
else:
# Normal script execution. Look in the current directory to allow
# running from the distribution.
return os.path.abspath(os.path.dirname(sys.argv[0]))
prefix = get_prefix() CONFIG_DIR = join(prefix, "config")
LOCALE_DIR = join(prefix, "locale")
# These lines are overwritten by the installer to hard-code the installed MISC_DIR = join(prefix, "misc")
# locations. PIXMAPS_DIR = join(prefix, "pixmaps")
CONFIG_DIR = join(prefix, "share", APP_NAME, "config") DOCS_DIR = join(prefix, "docs")
LOCALE_DIR = join(prefix, "share", APP_NAME, "locale")
MISC_DIR = join(prefix, "share", APP_NAME, "misc")
PIXMAPS_DIR = join(prefix, "share", "zenmap", "pixmaps")
DOCS_DIR = join(prefix, "share", APP_NAME, "docs")
NMAPDATADIR = join(prefix, "..")
def get_extra_executable_search_paths(): def get_extra_executable_search_paths():
@@ -125,7 +100,7 @@ class Paths(object):
config_files_list = ["config_file", config_files_list = ["config_file",
"scan_profile", "scan_profile",
"version"] ]
empty_config_files_list = ["target_list", empty_config_files_list = ["target_list",
"recent_scans", "recent_scans",
@@ -140,8 +115,16 @@ class Paths(object):
self.pixmaps_dir = PIXMAPS_DIR self.pixmaps_dir = PIXMAPS_DIR
self.misc_dir = MISC_DIR self.misc_dir = MISC_DIR
self.docs_dir = DOCS_DIR self.docs_dir = DOCS_DIR
self.nmap_dir = NMAPDATADIR
self._delayed_incomplete = True self._delayed_incomplete = True
PATH = os.environ.get('PATH', os.defpath)
extra = get_extra_executable_search_paths()
if extra:
PATH += ';' + ';'.join(extra)
NMAPPATH = dirname(shutil.which("nmap", path=PATH))
if sys.platform == 'win32':
self.nmap_dir = NMAPPATH
else:
self.nmap_dir = join(NMAPPATH, "..", "share", "nmap")
# Delay initializing these paths so that # Delay initializing these paths so that
# zenmapCore.I18N.install_gettext can install _() before modules that # zenmapCore.I18N.install_gettext can install _() before modules that
@@ -241,4 +224,3 @@ if __name__ == '__main__':
print(">>> OPTIONS:", Path.options) print(">>> OPTIONS:", Path.options)
print() print()
print(">>> DB:", Path.db) print(">>> DB:", Path.db)
print(">>> VERSION:", Path.version)

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 251 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 198 B

View File

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 193 B

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 459 B

View File

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB