root/trunk/install_scripts/windows/setup.py @ 2617

Revision 2617, 6.8 kB (checked in by xvg, 6 years ago)

Merge r5865, r5866, r5867, r5870, r5871, r5872, and r5881 from Nmap Umit branch.
Remove .dmp files from share/umit/config. There are files of the same names in share/umit/misc that are more up to date. The ones in config are not mentioned in the manifest.

Remove umit.db from the windows and macosx MANIFEST.in files. Also don't try to
copy umit.db when creating the user config directory. Running as a non-root
user made the copy fail, which caused an attempt to modify the umit.db in
/usr/share/umit/config, which caused a crash. Running as root worked because
the copy of umit.db (implemented by reading the contents then writing them
again) doesn't open the /usr/share database read-only, which creates a
zero-byte file which is then successfully copied. Files should probably be
opened read-only when doing these copies to avoid anomalies like this.

In copy_config_file, open the copied file in read-only mode to avoid accidentally creating it.

Simplify the code that loads icons and make it platform-independent.

Unify the three MANIFEST.in files now that they can be identical.

Install SVG icons on all platforms in the same way. I'm going to try to find the common parts of the setup.pys so that they might be combined.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright (C) 2005 Insecure.Com LLC.
5#
6# Author: Adriano Monteiro Marques <py.adriano@gmail.com>
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22import sys
23import os.path
24import os
25
26from py2exe.build_exe import py2exe as build_exe
27from distutils.core import setup
28from glob import glob
29
30################################################################################
31# Main Variables
32
33VERSION = os.environ.get("UMIT_VERSION", "0.4.5")
34REVISION = os.environ.get("UMIT_REVISION", "1567")
35
36SOURCE_PKG = False
37
38# Directories for POSIX operating systems
39# These are created after a "install" or "py2exe" command
40# These directories are relative to the installation or dist directory
41# Ex: python setup.py install --prefix=/tmp/umit
42# Will create the directory /tmp/umit with the following directories
43pixmaps_dir = os.path.join('share', 'pixmaps')
44icons_dir = os.path.join('share', 'icons')
45locale_dir = os.path.join('share', 'umit', 'locale')
46config_dir = os.path.join('share', 'umit', 'config')
47docs_dir = os.path.join('share', 'umit', 'docs')
48misc_dir = os.path.join('share', 'umit', 'misc')
49
50def mo_find(result, dirname, fnames):
51    files = []
52    for f in fnames:
53        p = os.path.join(dirname, f)
54        if os.path.isfile(p) and f.endswith(".mo"):
55            files.append(p)
56       
57    if files:
58        result.append((dirname, files))
59
60
61################################################################################
62# Installation variables
63
64# What to copy to the destiny
65# Here, we define what should be put inside the directories set in the beginning
66# of this file. This list contain tuples where the first element contains
67# a path to where the other elements of the tuple should be installed.
68# The first element is a path in the INSTALLATION PREFIX, and the other elements
69# are the path in the source base.
70# Ex: [("share/pixmaps", "/umit/trunk/share/pixmaps/test.png")]
71# This will install the test.png file in the installation dir share/pixmaps.
72data_files = [ (pixmaps_dir, glob(os.path.join(pixmaps_dir, '*.svg')) +
73                             glob(os.path.join(pixmaps_dir, '*.png')) +
74                             glob(os.path.join(pixmaps_dir, 'umit.o*'))),
75
76               (config_dir, [os.path.join(config_dir, 'umit.conf')] +
77                            [os.path.join(config_dir, 'scan_profile.usp')] +
78                            [os.path.join(config_dir, 'umit_version')] +
79                            glob(os.path.join(config_dir, '*.xml'))+
80                            glob(os.path.join(config_dir, '*.txt'))),
81
82               (misc_dir, glob(os.path.join(misc_dir, '*.dmp'))), 
83
84               (icons_dir, glob(os.path.join('share', 'icons', '*.ico'))+
85                           glob(os.path.join('share', 'icons', '*.png'))),
86
87               (docs_dir, glob(os.path.join(docs_dir, '*.html'))+
88                          glob(os.path.join(docs_dir,
89                                            'comparing_results', '*.xml'))+
90                          glob(os.path.join(docs_dir,
91                                            'profile_editor', '*.xml'))+
92                          glob(os.path.join(docs_dir,
93                                            'scanning', '*.xml'))+
94                          glob(os.path.join(docs_dir,
95                                            'searching', '*.xml'))+
96                          glob(os.path.join(docs_dir,
97                                            'wizard', '*.xml'))+
98                          glob(os.path.join(docs_dir,
99                                            'screenshots', '*.png')))]
100
101# Add i18n files to data_files list
102os.path.walk(locale_dir, mo_find, data_files)
103
104
105
106class umit_py2exe(build_exe):
107    def run(self):
108        base_dir = os.getcwd()
109        sys.path.append(os.path.join("install_scripts", "utils"))
110        from version_update import update_umit_compiled, update_paths, update_umit_version
111
112        update_umit_compiled(base_dir, VERSION, REVISION)
113        update_paths(base_dir, VERSION, REVISION)
114        update_umit_version(base_dir, VERSION, REVISION)
115
116        build_exe.run(self)
117        self.finish_banner()
118
119    def finish_banner(self):
120        print 
121        print "%s The compiled version of Umit %s-%s is in ./dist %s" % \
122              ("#"*10, VERSION, REVISION, "#"*10)
123        print
124
125
126##################### Umit banner ###################################
127print
128print "%s Umit for Windows %s-%s %s" % ("#"*10, VERSION, REVISION, "#"*10)
129print
130#####################################################################
131
132setup(name = 'umit',
133      license = 'GNU GPL (version 2 or later)',
134      url = 'http://umit.sourceforge.net',
135      download_url = 'http://sourceforge.net/project/showfiles.php?group_id=142490',
136      author = 'Adriano Monteiro & Cleber Rodrigues',
137      author_email = 'py.adriano@gmail.com, cleber@globalred.com.br',
138      maintainer = 'Adriano Monteiro',
139      maintainer_email = 'py.adriano@gmail.com',
140      description = """UMIT is a nmap frontend, developed in Python and GTK \
141and was started with the sponsoring of Google's Summer of Code.""",
142      long_description = """The project goal is to develop a nmap frontend \
143that is really useful for advanced users and easy to be used by newbies. With \
144UMIT, a network admin could create scan profiles for faster and easier network \
145scanning or even compare scan results to easily see any changes. A regular \
146user will also be able to construct powerful scans with UMIT command creator \
147wizards.""",
148      version = VERSION,
149      scripts = ['umit.pyw'],
150      packages = ['', 'umitCore', 'umitGUI', 'higwidgets'],
151      data_files = data_files,
152      cmdclass = {"py2exe":umit_py2exe},
153      windows = [{"script" : "umit.pyw",
154                  "icon_resources" : [(1, os.path.join("share", "icons", "umit_48.ico"))]}],
155      options = {"py2exe":{"compressed":1,
156                           "optimize":2,
157                           "packages":"encodings",
158                           "includes" : "pango,\
159atk,\
160gobject,\
161pickle,\
162bz2,\
163encodings,\
164encodings.*,\
165cairo,\
166pangocairo,\
167atk,\
168psyco"}})
Note: See TracBrowser for help on using the browser.