Zenmap: keep data files within package
@@ -79,13 +79,16 @@
|
||||
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
|
||||
</binary>
|
||||
|
||||
<!-- Python modules other than tnese are grabbed with get_deps.py -->
|
||||
<!-- Python modules other than these are grabbed with get_deps.py -->
|
||||
<binary>
|
||||
${prefix}/lib/python&PYVER;/site-packages/gi/*.so
|
||||
</binary>
|
||||
<binary>
|
||||
${prefix}/lib/python&PYVER;/site-packages/cairo/*.so
|
||||
</binary>
|
||||
<data>
|
||||
${prefix}/lib/python&PYVER;/site-packages/zenmapCore/data
|
||||
</data>
|
||||
|
||||
&pyreqs;
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@ zenmap = "zenmapGUI.App:run"
|
||||
[tool.setuptools]
|
||||
packages = [
|
||||
"zenmapCore",
|
||||
"zenmapCore.data.config",
|
||||
"zenmapCore.data.docs",
|
||||
"zenmapCore.data.locale",
|
||||
"zenmapCore.data.misc",
|
||||
"zenmapCore.data.pixmaps",
|
||||
"zenmapCore.data.pixmaps.radialnet",
|
||||
"zenmapGUI",
|
||||
"zenmapGUI.higwidgets",
|
||||
"radialnet",
|
||||
@@ -33,16 +39,15 @@ packages = [
|
||||
"radialnet.core",
|
||||
"radialnet.gui",
|
||||
"radialnet.util",
|
||||
"share",
|
||||
]
|
||||
|
||||
[tool.setuptools.dynamic]
|
||||
version = {attr = "zenmapCore.Version.VERSION"}
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"share.zenmap.pixmaps" = ["*.gif", "*.png"]
|
||||
"share.zenmap.pixmaps.radialnet" = ["*.png"]
|
||||
"share.zenmap.locale" = ["*.mo"]
|
||||
"share.zenmap.config" = ["zenmap.conf", "scan_profile.usp", "zenmap_version"]
|
||||
"share.zenmap.docs" = ["*.html"]
|
||||
"share.zenmap.misc" = ["*.xml"]
|
||||
"zenmapCore.data.pixmaps" = ["*.gif", "*.png"]
|
||||
"zenmapCore.data.pixmaps.radialnet" = ["*.png"]
|
||||
"zenmapCore.data.locale" = ["*.mo"]
|
||||
"zenmapCore.data.config" = ["zenmap.conf", "scan_profile.usp", "zenmap_version"]
|
||||
"zenmapCore.data.docs" = ["*.html"]
|
||||
"zenmapCore.data.misc" = ["*.xml"]
|
||||
|
||||
@@ -76,5 +76,4 @@ base_paths = dict(user_config_file=APP_NAME + '.conf',
|
||||
target_list='target_list.txt',
|
||||
options='options.xml',
|
||||
user_home=HOME,
|
||||
db=APP_NAME + ".db",
|
||||
version=APP_NAME + "_version")
|
||||
db=APP_NAME + ".db")
|
||||
|
||||
@@ -68,38 +68,13 @@ from zenmapCore.BasePaths import base_paths
|
||||
from zenmapCore.Name import APP_NAME
|
||||
|
||||
|
||||
# Find out the prefix under which data files (interface definition XML,
|
||||
# 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 = join(dirname(__file__), 'data')
|
||||
|
||||
prefix = get_prefix()
|
||||
|
||||
# These lines are overwritten by the installer to hard-code the installed
|
||||
# locations.
|
||||
CONFIG_DIR = join(prefix, "share", APP_NAME, "config")
|
||||
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, "..")
|
||||
CONFIG_DIR = join(prefix, "config")
|
||||
LOCALE_DIR = join(prefix, "locale")
|
||||
MISC_DIR = join(prefix, "misc")
|
||||
PIXMAPS_DIR = join(prefix, "pixmaps")
|
||||
DOCS_DIR = join(prefix, "docs")
|
||||
|
||||
|
||||
def get_extra_executable_search_paths():
|
||||
@@ -125,7 +100,7 @@ class Paths(object):
|
||||
|
||||
config_files_list = ["config_file",
|
||||
"scan_profile",
|
||||
"version"]
|
||||
]
|
||||
|
||||
empty_config_files_list = ["target_list",
|
||||
"recent_scans",
|
||||
@@ -140,8 +115,16 @@ class Paths(object):
|
||||
self.pixmaps_dir = PIXMAPS_DIR
|
||||
self.misc_dir = MISC_DIR
|
||||
self.docs_dir = DOCS_DIR
|
||||
self.nmap_dir = NMAPDATADIR
|
||||
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
|
||||
# zenmapCore.I18N.install_gettext can install _() before modules that
|
||||
@@ -241,4 +224,3 @@ if __name__ == '__main__':
|
||||
print(">>> OPTIONS:", Path.options)
|
||||
print()
|
||||
print(">>> DB:", Path.db)
|
||||
print(">>> VERSION:", Path.version)
|
||||
|
||||
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |