~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-16 22:00:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1942.
  • Revision ID: john@arbash-meinel.com-20060816220019-541cb90093258ac3
Using real utf8 and cache_utf8 has similar performance, 272ms, and 363ms

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
 
3
 
# This is an installation script for bzr.  Run it with
4
 
# './setup.py install', or
5
 
# './setup.py --help' for more options
6
 
 
 
3
"""Installation script for bzr.
 
4
Run it with
 
5
 './setup.py install', or
 
6
 './setup.py --help' for more options
 
7
"""
 
8
 
 
9
import bzrlib
 
10
 
 
11
##
 
12
# META INFORMATION FOR SETUP
 
13
 
 
14
META_INFO = {'name':         'bzr',
 
15
             'version':      bzrlib.__version__,
 
16
             'author':       'Canonical Ltd',
 
17
             'author_email': 'bazaar-ng@lists.ubuntu.com',
 
18
             'url':          'http://www.bazaar-vcs.org/',
 
19
             'description':  'Friendly distributed version control system',
 
20
             'license':      'GNU GPL v2',
 
21
            }
 
22
 
 
23
BZRLIB = {'packages': ['bzrlib',
 
24
                       'bzrlib.benchmarks',
 
25
                       'bzrlib.benchmarks.tree_creator',
 
26
                       'bzrlib.bundle',
 
27
                       'bzrlib.bundle.serializer',
 
28
                       'bzrlib.doc',
 
29
                       'bzrlib.doc.api',
 
30
                       'bzrlib.export',
 
31
                       'bzrlib.plugins',
 
32
                       'bzrlib.plugins.launchpad',
 
33
                       'bzrlib.store',
 
34
                       'bzrlib.store.revision',
 
35
                       'bzrlib.store.versioned',
 
36
                       'bzrlib.tests',
 
37
                       'bzrlib.tests.blackbox',
 
38
                       'bzrlib.tests.branch_implementations',
 
39
                       'bzrlib.tests.bzrdir_implementations',
 
40
                       'bzrlib.tests.interrepository_implementations',
 
41
                       'bzrlib.tests.intertree_implementations',
 
42
                       'bzrlib.tests.interversionedfile_implementations',
 
43
                       'bzrlib.tests.repository_implementations',
 
44
                       'bzrlib.tests.revisionstore_implementations',
 
45
                       'bzrlib.tests.tree_implementations',
 
46
                       'bzrlib.tests.workingtree_implementations',
 
47
                       'bzrlib.transport',
 
48
                       'bzrlib.transport.http',
 
49
                       'bzrlib.ui',
 
50
                       'bzrlib.util',
 
51
                       'bzrlib.util.configobj',
 
52
                       'bzrlib.util.effbot.org',
 
53
                       'bzrlib.util.elementtree',
 
54
                      ],
 
55
         }
 
56
 
 
57
PKG_DATA = {# install files from selftest suite
 
58
            'package_data': {'bzrlib': ['doc/api/*.txt',
 
59
                                        'tests/test_patches_data/*',
 
60
                                       ]},
 
61
           }
 
62
 
 
63
######################################################################
7
64
# Reinvocation stolen from bzr, we need python2.4 by virtue of bzr_man
8
65
# including bzrlib.help
9
66
 
10
 
import os, sys
 
67
import os
 
68
import sys
11
69
 
12
70
try:
13
71
    version_info = sys.version_info
55
113
        if sys.platform == "win32":
56
114
            try:
57
115
                scripts_dir = self.install_dir
58
 
                script_path = os.path.join(scripts_dir, "bzr")
59
 
                batch_str = "@%s %s %%*\n" % (sys.executable, script_path)
 
116
                script_path = self._quoted_path(os.path.join(scripts_dir,
 
117
                                                             "bzr"))
 
118
                python_exe = self._quoted_path(sys.executable)
 
119
                args = self._win_batch_args()
 
120
                batch_str = "@%s %s %s" % (python_exe, script_path, args)
60
121
                batch_path = script_path + ".bat"
61
122
                f = file(batch_path, "w")
62
123
                f.write(batch_str)
65
126
            except Exception, e:
66
127
                print "ERROR: Unable to create %s: %s" % (batch_path, e)
67
128
 
 
129
    def _quoted_path(self, path):
 
130
        if ' ' in path:
 
131
            return '"' + path + '"'
 
132
        else:
 
133
            return path
 
134
 
 
135
    def _win_batch_args(self):
 
136
        if os.name == 'nt':
 
137
            return '%*'
 
138
        else:
 
139
            return '%1 %2 %3 %4 %5 %6 %7 %8 %9'
 
140
#/class my_install_scripts
 
141
 
68
142
 
69
143
class bzr_build(build):
70
144
    """Customized build distutils action.
76
150
        import generate_docs
77
151
        generate_docs.main(argv=["bzr", "man"])
78
152
 
 
153
 
79
154
########################
80
155
## Setup
81
156
########################
82
157
 
83
 
setup(name='bzr',
84
 
      version='0.9pre',
85
 
      author='Canonical Ltd',
86
 
      author_email='bazaar-ng@lists.ubuntu.com',
87
 
      url='http://bazaar-vcs.org/',
88
 
      description='Friendly distributed version control system',
89
 
      license='GNU GPL v2',
90
 
      packages=['bzrlib',
91
 
                'bzrlib.benchmarks',
92
 
                'bzrlib.doc',
93
 
                'bzrlib.doc.api',
94
 
                'bzrlib.export',
95
 
                'bzrlib.plugins',
96
 
                'bzrlib.plugins.launchpad',
97
 
                'bzrlib.store',
98
 
                'bzrlib.store.revision',
99
 
                'bzrlib.store.versioned',
100
 
                'bzrlib.tests',
101
 
                'bzrlib.tests.blackbox',
102
 
                'bzrlib.tests.branch_implementations',
103
 
                'bzrlib.tests.bzrdir_implementations',
104
 
                'bzrlib.tests.interrepository_implementations',
105
 
                'bzrlib.tests.interversionedfile_implementations',
106
 
                'bzrlib.tests.repository_implementations',
107
 
                'bzrlib.tests.revisionstore_implementations',
108
 
                'bzrlib.tests.workingtree_implementations',
109
 
                'bzrlib.transport',
110
 
                'bzrlib.transport.http',
111
 
                'bzrlib.ui',
112
 
                'bzrlib.util',
113
 
                'bzrlib.util.elementtree',
114
 
                'bzrlib.util.effbot.org',
115
 
                'bzrlib.util.configobj',
116
 
                'bzrlib.bundle',
117
 
                'bzrlib.bundle.serializer'
118
 
                ],
119
 
      scripts=['bzr'],
120
 
      cmdclass={'install_scripts': my_install_scripts, 'build': bzr_build},
121
 
      data_files=[('man/man1', ['bzr.1'])],
122
 
    #   todo: install the txt files from bzrlib.doc.api.
123
 
     )
 
158
if 'bdist_wininst' in sys.argv:
 
159
    import glob
 
160
    # doc files
 
161
    docs = glob.glob('doc/*.htm') + ['doc/default.css']
 
162
    # python's distutils-based win32 installer
 
163
    ARGS = {'scripts': ['bzr', 'tools/win32/bzr-win32-bdist-postinstall.py'],
 
164
            # help pages
 
165
            'data_files': [('Doc/Bazaar', docs)],
 
166
           }
 
167
 
 
168
    ARGS.update(META_INFO)
 
169
    ARGS.update(BZRLIB)
 
170
    ARGS.update(PKG_DATA)
 
171
    
 
172
    setup(**ARGS)
 
173
 
 
174
elif 'py2exe' in sys.argv:
 
175
    # py2exe setup
 
176
    import py2exe
 
177
 
 
178
    # pick real bzr version
 
179
    import bzrlib
 
180
 
 
181
    version_number = []
 
182
    for i in bzrlib.version_info[:4]:
 
183
        try:
 
184
            i = int(i)
 
185
        except ValueError:
 
186
            i = 0
 
187
        version_number.append(str(i))
 
188
    version_str = '.'.join(version_number)
 
189
 
 
190
    target = py2exe.build_exe.Target(script = "bzr",
 
191
                                     dest_base = "bzr",
 
192
                                     icon_resources = [(0,'bzr.ico')],
 
193
                                     name = META_INFO['name'],
 
194
                                     version = version_str,
 
195
                                     description = META_INFO['description'],
 
196
                                     author = META_INFO['author'],
 
197
                                     copyright = "(c) Canonical Ltd, 2005-2006",
 
198
                                     company_name = "Canonical Ltd.",
 
199
                                     comments = META_INFO['description'],
 
200
                                    )
 
201
    options_list = {"py2exe": {"packages": BZRLIB['packages'] +
 
202
                                           ['elementtree'],
 
203
                               "excludes": ["Tkinter", "medusa"],
 
204
                               "dist_dir": "win32_bzr.exe",
 
205
                              },
 
206
                   }
 
207
    setup(options=options_list,
 
208
          console=[target,
 
209
                   'tools/win32/bzr_postinstall.py',
 
210
                  ],
 
211
          zipfile='lib/library.zip')
 
212
 
 
213
else:
 
214
    # std setup
 
215
    ARGS = {'scripts': ['bzr'],
 
216
            'data_files': [('man/man1', ['bzr.1'])],
 
217
            'cmdclass': {'build': bzr_build,
 
218
                         'install_scripts': my_install_scripts,
 
219
                        },
 
220
           }
 
221
    
 
222
    ARGS.update(META_INFO)
 
223
    ARGS.update(BZRLIB)
 
224
    ARGS.update(PKG_DATA)
 
225
 
 
226
    setup(**ARGS)