| 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 sys |
|---|
| 24 | import os.path |
|---|
| 25 | import os |
|---|
| 26 | |
|---|
| 27 | from py2exe.build_exe import py2exe as build_exe |
|---|
| 28 | from distutils.core import setup |
|---|
| 29 | from glob import glob |
|---|
| 30 | |
|---|
| 31 | sys.path += [os.getcwd()] |
|---|
| 32 | |
|---|
| 33 | from umitWeb.Version import VERSION |
|---|
| 34 | |
|---|
| 35 | ################################################################################ |
|---|
| 36 | # Main Variables |
|---|
| 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 |
|---|
| 43 | pixmaps_dir = os.path.join('share', 'pixmaps', 'umit') |
|---|
| 44 | icons_dir = os.path.join('share', 'icons', 'umit') |
|---|
| 45 | locale_dir = os.path.join('share', 'locale') |
|---|
| 46 | config_dir = os.path.join('share', 'umit', 'config') |
|---|
| 47 | docs_dir = os.path.join('share', 'doc', 'umit') |
|---|
| 48 | misc_dir = os.path.join('share', 'umit', 'misc') |
|---|
| 49 | templates_dir = os.path.join('share', 'umit', 'templates') |
|---|
| 50 | media_dir = os.path.join('share', 'umit', 'umitweb_media') |
|---|
| 51 | sql_dir = os.path.join('share', 'umit', 'sql') |
|---|
| 52 | |
|---|
| 53 | def mo_find(result, dirname, fnames): |
|---|
| 54 | files = [] |
|---|
| 55 | for f in fnames: |
|---|
| 56 | p = os.path.join(dirname, f) |
|---|
| 57 | if os.path.isfile(p) and f.endswith(".mo"): |
|---|
| 58 | files.append(p) |
|---|
| 59 | |
|---|
| 60 | if files: |
|---|
| 61 | result.append((dirname, files)) |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | ############################################################################## |
|---|
| 65 | # Installation variables |
|---|
| 66 | |
|---|
| 67 | # What to copy to the destiny |
|---|
| 68 | # Here, we define what should be put inside the directories set in the |
|---|
| 69 | # beginning of this file. This list contain tuples where the first element |
|---|
| 70 | # contains a path to where the other elements of the tuple should be installed. |
|---|
| 71 | # The first element is a path in the INSTALLATION PREFIX, and the other |
|---|
| 72 | # elements are the path in the source base. |
|---|
| 73 | # Ex: [("share/pixmaps", "/umit/trunk/share/pixmaps/test.png")] |
|---|
| 74 | # This will install the test.png file in the installation dir share/pixmaps. |
|---|
| 75 | svg = glob(os.path.join('share', 'pixmaps', '*.svg')) |
|---|
| 76 | data_files = [ |
|---|
| 77 | (pixmaps_dir, glob(os.path.join(pixmaps_dir, '*.svg')) + |
|---|
| 78 | glob(os.path.join(pixmaps_dir, '*.png')) + |
|---|
| 79 | glob(os.path.join(pixmaps_dir, '*.xpm')) + |
|---|
| 80 | glob(os.path.join(pixmaps_dir, 'umit.o*'))), |
|---|
| 81 | |
|---|
| 82 | (config_dir, [os.path.join(config_dir, 'umit.conf')] + |
|---|
| 83 | [os.path.join(config_dir, 'scan_profile.usp')] + |
|---|
| 84 | [os.path.join(config_dir, 'umit_version')] + |
|---|
| 85 | [os.path.join(config_dir, 'umitweb.conf')] + |
|---|
| 86 | [os.path.join(config_dir, 'umitng.db')] + |
|---|
| 87 | [os.path.join(config_dir, 'timeline-settings.conf')] + |
|---|
| 88 | [os.path.join(config_dir, 'tl_colors_evt_std.conf')] + |
|---|
| 89 | [os.path.join(config_dir, 'scheduler-schemas.conf')] + |
|---|
| 90 | [os.path.join(config_dir, 'scheduler-profiles.conf')] + |
|---|
| 91 | [os.path.join(config_dir, 'scheduler.log')] + |
|---|
| 92 | [os.path.join(config_dir, 'smtp-schemas.conf')] + |
|---|
| 93 | glob(os.path.join(config_dir, '*.xml'))+ |
|---|
| 94 | glob(os.path.join(config_dir, '*.txt'))), |
|---|
| 95 | |
|---|
| 96 | # Radialnet |
|---|
| 97 | (os.path.join(pixmaps_dir, 'radialnet', 'application'), |
|---|
| 98 | glob(os.path.join(pixmaps_dir, 'radialnet', 'application', |
|---|
| 99 | '*.png'))), |
|---|
| 100 | (os.path.join(pixmaps_dir, 'radialnet', 'icons'), |
|---|
| 101 | glob(os.path.join(pixmaps_dir, 'radialnet', 'icons','*.png'))), |
|---|
| 102 | |
|---|
| 103 | # Network Inventory |
|---|
| 104 | (os.path.join(pixmaps_dir, 'networkinventory'), |
|---|
| 105 | glob(os.path.join(pixmaps_dir, 'networkinventory', '*.png'))), |
|---|
| 106 | |
|---|
| 107 | # InterfaceEditor |
|---|
| 108 | (os.path.join(pixmaps_dir, 'uie'), |
|---|
| 109 | glob(os.path.join(pixmaps_dir, 'uie', '*.png'))), |
|---|
| 110 | |
|---|
| 111 | # umitDB SQL |
|---|
| 112 | (sql_dir, glob(os.path.join("umitDB/sql", "*.sql"))), |
|---|
| 113 | |
|---|
| 114 | (misc_dir, glob(os.path.join(misc_dir, '*.dmp'))), |
|---|
| 115 | (docs_dir, glob(os.path.join(docs_dir, '*.html'))+ |
|---|
| 116 | glob(os.path.join(docs_dir, |
|---|
| 117 | 'comparing_results', '*.xml'))+ |
|---|
| 118 | glob(os.path.join(docs_dir, |
|---|
| 119 | 'profile_editor', '*.xml'))+ |
|---|
| 120 | glob(os.path.join(docs_dir, |
|---|
| 121 | 'scanning', '*.xml'))+ |
|---|
| 122 | glob(os.path.join(docs_dir, |
|---|
| 123 | 'searching', '*.xml'))+ |
|---|
| 124 | glob(os.path.join(docs_dir, |
|---|
| 125 | 'wizard', '*.xml'))+ |
|---|
| 126 | glob(os.path.join(docs_dir, 'scheduler', '*.xml')) + |
|---|
| 127 | glob(os.path.join(docs_dir, 'smtpsetup', '*.xml')) + |
|---|
| 128 | glob(os.path.join(docs_dir, |
|---|
| 129 | 'screenshots', '*.png'))), |
|---|
| 130 | (os.path.join(media_dir, 'js'), |
|---|
| 131 | glob(os.path.join(media_dir, 'js', '*.js'))), |
|---|
| 132 | (os.path.join(media_dir, 'css'), |
|---|
| 133 | glob(os.path.join(media_dir, 'css', '*.css'))), |
|---|
| 134 | (os.path.join(media_dir, 'images'), |
|---|
| 135 | glob(os.path.join(media_dir, 'images', '*.jpg')) + |
|---|
| 136 | glob(os.path.join(media_dir, 'images', '*.png')) + |
|---|
| 137 | glob(os.path.join(media_dir, 'images', '*.gif'))), |
|---|
| 138 | (templates_dir, glob(os.path.join(templates_dir, '*.html'))), |
|---|
| 139 | (os.path.join(templates_dir, 'html'), |
|---|
| 140 | glob(os.path.join(templates_dir, 'html', '*.html')))] |
|---|
| 141 | |
|---|
| 142 | (icons_dir, glob(os.path.join('share', 'icons', 'umit', '*.ico')) + |
|---|
| 143 | glob(os.path.join('share', 'icons', 'umit', '*.png'))), |
|---|
| 144 | |
|---|
| 145 | (docs_dir, glob(os.path.join(docs_dir, '*.html')) + |
|---|
| 146 | glob(os.path.join(docs_dir, 'comparing_results', '*.xml')) + |
|---|
| 147 | glob(os.path.join(docs_dir, 'profile_editor', '*.xml')) + |
|---|
| 148 | glob(os.path.join(docs_dir, 'scanning', '*.xml')) + |
|---|
| 149 | glob(os.path.join(docs_dir, 'searching', '*.xml')) + |
|---|
| 150 | glob(os.path.join(docs_dir, 'wizard', '*.xml')) + |
|---|
| 151 | glob(os.path.join(docs_dir, 'scheduler', '*.xml')) + |
|---|
| 152 | glob(os.path.join(docs_dir, 'smtpsetup', '*.xml')) + |
|---|
| 153 | glob(os.path.join(docs_dir, 'screenshots', '*.png')))] |
|---|
| 154 | |
|---|
| 155 | # Add i18n files to data_files list |
|---|
| 156 | os.path.walk(locale_dir, mo_find, data_files) |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | class umit_py2exe(build_exe): |
|---|
| 160 | def run(self): |
|---|
| 161 | build_exe.run(self) |
|---|
| 162 | self.finish_banner() |
|---|
| 163 | |
|---|
| 164 | def finish_banner(self): |
|---|
| 165 | print |
|---|
| 166 | print "%s The compiled version of Umit %s is in ./dist %s" % \ |
|---|
| 167 | ("#"*10, VERSION, "#"*10) |
|---|
| 168 | print |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | ##################### Umit banner ################################### |
|---|
| 172 | print |
|---|
| 173 | print "%s Umit for Windows %s %s" % ("#"*10, VERSION, "#"*10) |
|---|
| 174 | print |
|---|
| 175 | ##################################################################### |
|---|
| 176 | |
|---|
| 177 | setup(name = 'umit', |
|---|
| 178 | license = 'GNU GPL (version 2 or later)', |
|---|
| 179 | url = 'http://www.umitproject.org', |
|---|
| 180 | download_url = 'http://www.umitproject.org', |
|---|
| 181 | author = 'Adriano Monteiro, Cleber Rodrigues & Rodolfo Carvalho', |
|---|
| 182 | author_email = 'adriano@umitproject.org, cleber@globalred.com.br, rodolfo@umitproject.org', |
|---|
| 183 | maintainer = 'Adriano Monteiro', |
|---|
| 184 | maintainer_email = 'adriano@umitproject.org', |
|---|
| 185 | description = """Umit is a network scanning frontend, developed in \ |
|---|
| 186 | Python and GTK and was started with the sponsoring of Google's Summer of \ |
|---|
| 187 | Code.""", |
|---|
| 188 | long_description = """The project goal is to develop a network scanning \ |
|---|
| 189 | frontend that is really useful for advanced users and easy to be used by \ |
|---|
| 190 | newbies. With Umit, a network admin could create scan profiles for faster and \ |
|---|
| 191 | easier network scanning or even compare scan results to easily see any \ |
|---|
| 192 | changes. A regular user will also be able to construct powerful scans with \ |
|---|
| 193 | Umit command creator wizards.""", |
|---|
| 194 | version = VERSION, |
|---|
| 195 | scripts = ['umitwebserver', 'umit-scheduler'], |
|---|
| 196 | packages = [ |
|---|
| 197 | 'umitCore', 'umitCore.radialnet', 'umitDB', 'umitWeb', 'umitWeb.views', 'umitWeb.views.html', |
|---|
| 198 | 'umitInventory', 'umitPlugin', 'umitInterfaceEditor', 'umitInterfaceEditor.selectborder', |
|---|
| 199 | 'higwidgets'], |
|---|
| 200 | data_files = data_files, |
|---|
| 201 | zipfile=None, |
|---|
| 202 | cmdclass = {"py2exe":umit_py2exe}, |
|---|
| 203 | windows = [{"script": "management_console.pyw", |
|---|
| 204 | "icon_resources" : [(1, os.path.join("share", "icons", "umit_48.ico"))]}], |
|---|
| 205 | console = [{"script": "umitwebserver", |
|---|
| 206 | "icon_resources" : [(1, os.path.join("share", "icons", "umit_48.ico"))]}], |
|---|
| 207 | options = {"py2exe":{"compressed": 1, |
|---|
| 208 | "optimize": 2, |
|---|
| 209 | "packages": "encodings", |
|---|
| 210 | "includes" : "pango,\ |
|---|
| 211 | atk,\ |
|---|
| 212 | gobject,\ |
|---|
| 213 | pickle,\ |
|---|
| 214 | bz2,\ |
|---|
| 215 | encodings,\ |
|---|
| 216 | encodings.*,\ |
|---|
| 217 | cairo,\ |
|---|
| 218 | pangocairo,\ |
|---|
| 219 | atk,\ |
|---|
| 220 | psyco"}}) |
|---|