| 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 | |
|---|
| 22 | import sys |
|---|
| 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 | ################################################################################ |
|---|
| 31 | # Main Variables |
|---|
| 32 | |
|---|
| 33 | VERSION = os.environ.get("UMIT_VERSION", "0.4.5") |
|---|
| 34 | REVISION = os.environ.get("UMIT_REVISION", "1567") |
|---|
| 35 | |
|---|
| 36 | SOURCE_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 |
|---|
| 43 | pixmaps_dir = os.path.join('share', 'pixmaps') |
|---|
| 44 | icons_dir = os.path.join('share', 'icons') |
|---|
| 45 | locale_dir = os.path.join('share', 'umit', 'locale') |
|---|
| 46 | config_dir = os.path.join('share', 'umit', 'config') |
|---|
| 47 | docs_dir = os.path.join('share', 'umit', 'docs') |
|---|
| 48 | misc_dir = os.path.join('share', 'umit', 'misc') |
|---|
| 49 | |
|---|
| 50 | def 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. |
|---|
| 72 | data_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 |
|---|
| 102 | os.path.walk(locale_dir, mo_find, data_files) |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | class 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 ################################### |
|---|
| 127 | print |
|---|
| 128 | print "%s Umit for Windows %s-%s %s" % ("#"*10, VERSION, REVISION, "#"*10) |
|---|
| 129 | print |
|---|
| 130 | ##################################################################### |
|---|
| 131 | |
|---|
| 132 | setup(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 \ |
|---|
| 141 | and was started with the sponsoring of Google's Summer of Code.""", |
|---|
| 142 | long_description = """The project goal is to develop a nmap frontend \ |
|---|
| 143 | that is really useful for advanced users and easy to be used by newbies. With \ |
|---|
| 144 | UMIT, a network admin could create scan profiles for faster and easier network \ |
|---|
| 145 | scanning or even compare scan results to easily see any changes. A regular \ |
|---|
| 146 | user will also be able to construct powerful scans with UMIT command creator \ |
|---|
| 147 | wizards.""", |
|---|
| 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,\ |
|---|
| 159 | atk,\ |
|---|
| 160 | gobject,\ |
|---|
| 161 | pickle,\ |
|---|
| 162 | bz2,\ |
|---|
| 163 | encodings,\ |
|---|
| 164 | encodings.*,\ |
|---|
| 165 | cairo,\ |
|---|
| 166 | pangocairo,\ |
|---|
| 167 | atk,\ |
|---|
| 168 | psyco"}}) |
|---|