| 1 | #!/usr/bin/env python |
|---|
| 2 | # -*- coding: utf-8 -*- |
|---|
| 3 | # |
|---|
| 4 | # Copyright (C) 2005-2006 Insecure.Com LLC. |
|---|
| 5 | # Copyright (C) 2007-2008 Adriano Monteiro Marques |
|---|
| 6 | # |
|---|
| 7 | # Author: Adriano Monteiro Marques <adriano@umitproject.org> |
|---|
| 8 | # |
|---|
| 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 |
|---|
| 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 22 | |
|---|
| 23 | import os.path |
|---|
| 24 | import os |
|---|
| 25 | |
|---|
| 26 | from py2exe.build_exe import py2exe as build_exe |
|---|
| 27 | from distutils.core import setup |
|---|
| 28 | from glob import glob |
|---|
| 29 | |
|---|
| 30 | from umitCore.Version import VERSION |
|---|
| 31 | |
|---|
| 32 | ############################################################################## |
|---|
| 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 |
|---|
| 40 | pixmaps_dir = os.path.join('share', 'pixmaps', 'umit') |
|---|
| 41 | icons_dir = os.path.join('share', 'icons', 'umit') |
|---|
| 42 | locale_dir = os.path.join('share', 'locale') |
|---|
| 43 | config_dir = os.path.join('share', 'umit', 'config') |
|---|
| 44 | docs_dir = os.path.join('share', 'doc', 'umits') |
|---|
| 45 | misc_dir = os.path.join('share', 'umit', 'misc') |
|---|
| 46 | sql_dir = os.path.join('share', 'umit', 'sql') |
|---|
| 47 | |
|---|
| 48 | def 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 | |
|---|
| 59 | ############################################################################## |
|---|
| 60 | # Installation variables |
|---|
| 61 | |
|---|
| 62 | # What to copy to the destiny |
|---|
| 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. |
|---|
| 68 | # Ex: [("share/pixmaps", "/umit/trunk/share/pixmaps/test.png")] |
|---|
| 69 | # This will install the test.png file in the installation dir share/pixmaps. |
|---|
| 70 | svg = glob(os.path.join('share', 'pixmaps', '*.svg')) |
|---|
| 71 | data_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'))), |
|---|
| 80 | |
|---|
| 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'))), |
|---|
| 93 | |
|---|
| 94 | # Network Inventory |
|---|
| 95 | (os.path.join(pixmaps_dir, 'networkinventory'), |
|---|
| 96 | glob(os.path.join(pixmaps_dir, 'networkinventory', '*.png'))), |
|---|
| 97 | |
|---|
| 98 | # InterfaceEditor |
|---|
| 99 | (os.path.join(pixmaps_dir, 'uie'), |
|---|
| 100 | glob(os.path.join(pixmaps_dir, 'uie', '*.png'))), |
|---|
| 101 | |
|---|
| 102 | # umitDB SQL |
|---|
| 103 | (sql_dir, glob(os.path.join("umitDB/sql", "*.sql"))), |
|---|
| 104 | |
|---|
| 105 | (misc_dir, glob(os.path.join(misc_dir, '*.dmp'))), |
|---|
| 106 | |
|---|
| 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 | |
|---|
| 120 | # Add i18n files to data_files list |
|---|
| 121 | os.path.walk(locale_dir, mo_find, data_files) |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | class umit_py2exe(build_exe): |
|---|
| 125 | def run(self): |
|---|
| 126 | build_exe.run(self) |
|---|
| 127 | self.finish_banner() |
|---|
| 128 | |
|---|
| 129 | def finish_banner(self): |
|---|
| 130 | print |
|---|
| 131 | print "%s The compiled version of Umit %s is in ./dist %s" % \ |
|---|
| 132 | ("#"*10, VERSION, "#"*10) |
|---|
| 133 | print |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | ##################### Umit banner ################################### |
|---|
| 137 | print |
|---|
| 138 | print "%s Umit for Windows %s %s" % ("#"*10, VERSION, "#"*10) |
|---|
| 139 | print |
|---|
| 140 | ##################################################################### |
|---|
| 141 | |
|---|
| 142 | setup(name = 'umit', |
|---|
| 143 | license = 'GNU GPL (version 2 or later)', |
|---|
| 144 | url = 'http://www.umitproject.org', |
|---|
| 145 | download_url = 'http://www.umitproject.org', |
|---|
| 146 | author = 'Adriano Monteiro & Cleber Rodrigues', |
|---|
| 147 | author_email = 'adriano@umitproject.org, cleber@globalred.com.br', |
|---|
| 148 | maintainer = 'Adriano Monteiro', |
|---|
| 149 | maintainer_email = 'adriano@umitproject.org', |
|---|
| 150 | description = """Umit is a network scanning frontend, developed in \ |
|---|
| 151 | Python and GTK and was started with the sponsoring of Google's Summer of \ |
|---|
| 152 | Code.""", |
|---|
| 153 | long_description = """The project goal is to develop a network scanning \ |
|---|
| 154 | frontend that is really useful for advanced users and easy to be used by \ |
|---|
| 155 | newbies. With Umit, a network admin could create scan profiles for faster and \ |
|---|
| 156 | easier network scanning or even compare scan results to easily see any \ |
|---|
| 157 | changes. A regular user will also be able to construct powerful scans with \ |
|---|
| 158 | Umit command creator wizards.""", |
|---|
| 159 | version = VERSION, |
|---|
| 160 | scripts = ['umit'], |
|---|
| 161 | packages = ['', 'umitCore','umitCore.radialnet', 'umitDB', 'umitGUI', |
|---|
| 162 | 'umitInventory', 'umitPlugin', 'umitGUI.radialnet', |
|---|
| 163 | 'umitInterfaceEditor', 'umitInterfaceEditor.selectborder', |
|---|
| 164 | 'higwidgets'], |
|---|
| 165 | data_files = data_files, |
|---|
| 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 | ) |
|---|