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

Revision 4058, 7.4 kB (checked in by gpolo, 4 years ago)

Code relayout

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