root/gaphor/trunk/setup.py

Revision 2307, 7.6 kB (checked in by wrobe..@pld-linux.org, 1 month ago)

- fixed indentation issues

Line 
1 """
2 Setup script for Gaphor.
3
4 Run 'python setup.py develop' to set up a development environment, including
5 dependencies.
6
7 Run 'python setup.py run' to start Gaphor directly (without install).
8 """
9
10 VERSION = '0.13.1'
11
12 import os
13 import sys
14 sys.path.insert(0, '.')
15
16 from ez_setup import use_setuptools
17
18 use_setuptools()
19
20 from setuptools import setup, find_packages
21 from distutils.cmd import Command
22
23 from utils.command.build_mo import build_mo
24 from utils.command.build_pot import build_pot
25 from utils.command.build_uml import build_uml
26 from utils.command.install_lib import install_lib
27 from utils.command.run import run
28
29 LINGUAS = [ 'ca', 'es', 'nl', 'sv' ]
30
31 # Wrap setuptools' build_py command, so we're sure build_uml is performed
32 # before the build_py code.
33
34 from setuptools.command.build_py import build_py
35
36 class build_py_with_sub_commands(build_py):
37
38     def run(self):
39         for cmd_name in self.get_sub_commands():
40             self.run_command(cmd_name)
41
42         build_py.run(self)
43    
44 build_py_with_sub_commands.sub_commands.append(('build_uml', None))
45
46
47 class build_doc(Command):
48     description = 'Builds the documentation'
49     user_options = []
50
51     def initialize_options(self):
52         pass
53
54     def finalize_options(self):
55         pass
56
57     def run(self):
58 #        from docutils.core import publish_cmdline
59 #        docutils_conf = os.path.join('doc', 'docutils.conf')
60         epydoc_conf = os.path.join('doc', 'epydoc.conf')
61
62 #        for source in glob('doc/*.txt'):
63 #            dest = os.path.splitext(source)[0] + '.html'
64 #            if not os.path.exists(dest) or \
65 #                   os.path.getmtime(dest) < os.path.getmtime(source):
66 #                print 'building documentation file %s' % dest
67 #                publish_cmdline(writer_name='html',
68 #                                argv=['--config=%s' % docutils_conf, source,
69 #                                      dest])
70
71         try:
72             from epydoc import cli
73             old_argv = sys.argv[1:]
74             sys.argv[1:] = [
75                 '--config=%s' % epydoc_conf,
76                 '--no-private', # epydoc bug, not read from config
77                 '--simple-term',
78                 '--verbose'
79             ]
80             cli.cli()
81             sys.argv[1:] = old_argv
82
83         except ImportError:
84             print 'epydoc not installed, skipping API documentation.'
85
86
87 data_files = []
88
89 if sys.platform != 'win32':
90     data_files = [
91         ('share/pixmaps', ['gaphor/ui/pixmaps/gaphor-48x48.png']),
92         ('share/applications', ['gaphor.desktop']),
93     ]
94
95 if sys.platform == 'darwin' and 'py2app' in sys.argv:
96     # Mac OS X
97     import pkg_resources
98     pkg_resources.require('zope.component')
99     platform_setup_requires=['py2app']
100     platform_setup = dict(
101         app=['gaphor-osx.py'],
102         )
103 elif sys.platform == 'win32' and 'py2exe' in sys.argv:
104     # Windows
105     import py2exe
106     platform_setup_requires = ['py2exe']
107     platform_setup= { 'app': ['gaphor'], }
108
109     import pkg_resources
110     eggs = pkg_resources.require("gaphor")
111     for egg in eggs:
112         if os.path.isdir(egg.location):
113             sys.path.insert(0, egg.location)
114             continue
115         else:
116             print 'Can only handle unpacked eggs.'
117     egg_names = []
118     for egg in eggs:
119         egg_names.append(egg.project_name)
120 else:
121     platform_setup_requires = []
122     platform_setup = dict()
123
124
125 setup(
126     name='gaphor',
127     version=VERSION,
128     url='http://gaphor.devjavu.com',
129     author='Arjan J. Molenaar',
130     author_email='arjanmol@users.sourceforge.net',
131     license='GNU General Public License',
132     description='Gaphor is a UML modeling tool',
133     long_description="""
134 Gaphor is a UML modeling tool written in Python.
135
136 It uses the GTK+ environment for user interaction.
137 """,
138     data_files=data_files,
139     classifiers = [
140         'Development Status :: 4 - Beta',
141         'Environment :: X11 Applications :: GTK',
142         'Intended Audience :: Developers',
143         'Intended Audience :: End Users/Desktop',
144         'Intended Audience :: Information Technology',
145         'License :: OSI Approved :: GNU General Public License (GPL)',
146         'Operating System :: MacOS :: MacOS X',
147         'Operating System :: Microsoft :: Windows',
148         'Operating System :: POSIX',
149         'Operating System :: Unix',
150         'Programming Language :: Python',
151         'Topic :: Multimedia :: Graphics :: Editors :: Vector-Based',
152         'Topic :: Software Development :: Documentation',
153     ],
154
155     keywords = 'model modeling modelling uml diagram python tool',
156
157     packages = find_packages(exclude=['ez_setup', 'utils*']),
158
159     include_package_data = True,
160
161     install_requires = [
162         # 'PyGTK >= 2.8.0', - Exclude, since it will not build anyway
163         'gaphas >= 0.3.0',
164         'zope.component >= 3.4.0', # - won't compile on windows.
165     ],
166
167     zip_safe = False,
168
169     #test_suite = 'nose.collector',
170
171     entry_points = {
172         'console_scripts': [
173             'gaphor = gaphor:main',
174             'gaphorconvert = gaphor.tools.gaphorconvert:main',
175         ],
176         'gaphor.services': [
177             'adapter_loader = gaphor.services.adapterloader:AdapterLoader',
178             'properties = gaphor.services.properties:Properties',
179             'undo_manager = gaphor.services.undomanager:UndoManager',
180             'element_factory = gaphor.UML.elementfactory:ElementFactory',
181             'file_manager = gaphor.services.filemanager:FileManager',
182             'diagram_export_manager = gaphor.services.diagramexportmanager:DiagramExportManager',
183             'action_manager = gaphor.services.actionmanager:ActionManager',
184             'gui_manager = gaphor.services.guimanager:GUIManager',
185             'copy = gaphor.services.copyservice:CopyService',
186             'sanitizer = gaphor.services.sanitizerservice:SanitizerService',
187             'xmi_export = gaphor.plugins.xmiexport:XMIExport',
188             'diagram_layout = gaphor.plugins.diagramlayout:DiagramLayout',
189             'pynsource = gaphor.plugins.pynsource:PyNSource',
190             'check_metamodel = gaphor.plugins.checkmetamodel:CheckModelWindow',
191             'live_object_browser = gaphor.plugins.liveobjectbrowser:LiveObjectBrowser',
192             'alignment = gaphor.plugins.alignment:Alignment',
193             'help = gaphor.services.helpservice:HelpService',
194         ],
195         'gaphor.uicomponents': [
196             'mainwindow = gaphor.ui.mainwindow:MainWindow',
197             'consolewindow = gaphor.ui.consolewindow:ConsoleWindow',
198         ],
199     },
200
201     cmdclass = {
202               'build_py': build_py_with_sub_commands,
203               'build_uml': build_uml,
204               'build_mo': build_mo,
205               'build_pot': build_pot,
206               'build_doc': build_doc,
207               'install_lib': install_lib,
208               'run': run,
209     },
210
211     setup_requires = ['nose >= 0.9.2'] + platform_setup_requires,
212
213     test_suite = 'nose.collector',
214
215     options = dict(
216         py2app = dict(
217             argv_emulation=True,
218             semi_standalone=True, # Depend on installed Python 2.4 Framework
219             includes=['atk', 'pango', 'cairo', 'pangocairo'], #'zope.defferedimport', 'zope.component', 'zope.deprecation', 'zope.interface', 'zope.event', 'zope.testing', 'zope.proxy'],
220             packages=['gaphor', 'zope'],
221             plist=dict(
222                 CFBundleGetInfoString='Gaphor',
223                 CFBundleIdentifier='com.devjavu.gaphor'
224                 )
225         ),
226         py2exe = dict(
227             packages='gaphas, decorator',
228             includes='cairo, pango, pangocairo, atk',
229         ),
230        
231         build_pot = dict(
232             all_linguas = ','.join(LINGUAS),
233         ),
234         build_mo = dict(
235             all_linguas = ','.join(LINGUAS),
236         ),
237
238     ),
239
240     **platform_setup
241
242 )
243  
244 # vim:sw=4:et:ai
Note: See TracBrowser for help on using the browser.