~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-31 16:12:57 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060731161257-91a231523255332c
new official bzr.ico

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