~bzr-pqm/bzr/bzr.dev

45 by Martin Pool
- add setup.py and install instructions
1
#! /usr/bin/env python
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
1185.29.5 by Wouter van Heyst
Add reinvocation code to ensure setup.py is run by python2.4
7
# Reinvocation stolen from bzr, we need python2.4 by virtue of bzr_man
8
# including bzrlib.help
9
10
import os, sys
11
12
try:
13
    version_info = sys.version_info
14
except AttributeError:
15
    version_info = 1, 5 # 1.5 or older
16
17
REINVOKE = "__BZR_REINVOKE"
18
NEED_VERS = (2, 4)
19
KNOWN_PYTHONS = ('python2.4',)
20
21
if version_info < NEED_VERS:
22
    if not os.environ.has_key(REINVOKE):
23
        # mutating os.environ doesn't work in old Pythons
24
        os.putenv(REINVOKE, "1")
25
        for python in KNOWN_PYTHONS:
26
            try:
27
                os.execvp(python, [python] + sys.argv)
28
            except OSError:
29
                pass
30
    print >>sys.stderr, "bzr: error: cannot find a suitable python interpreter"
31
    print >>sys.stderr, "  (need %d.%d or later)" % NEED_VERS
32
    sys.exit(1)
33
if hasattr(os, "unsetenv"):
34
    os.unsetenv(REINVOKE)
35
36
45 by Martin Pool
- add setup.py and install instructions
37
from distutils.core import setup
1185.23.1 by Aaron Bentley
win32 setup fixes from Belchenko
38
from distutils.command.install_scripts import install_scripts
1185.29.3 by Wouter van Heyst
Create bzr.1 manpage from setup.py
39
from distutils.command.build import build
1185.1.40 by Robert Collins
Merge what applied of Alexander Belchenko's win32 patch.
40
41
###############################
42
# Overridden distutils actions
43
###############################
44
1185.23.1 by Aaron Bentley
win32 setup fixes from Belchenko
45
class my_install_scripts(install_scripts):
46
    """ Customized install_scripts distutils action.
1185.1.40 by Robert Collins
Merge what applied of Alexander Belchenko's win32 patch.
47
    Create bzr.bat for win32.
48
    """
49
    def run(self):
1185.23.1 by Aaron Bentley
win32 setup fixes from Belchenko
50
        import os
51
        import sys
52
53
        install_scripts.run(self)   # standard action
54
1185.1.40 by Robert Collins
Merge what applied of Alexander Belchenko's win32 patch.
55
        if sys.platform == "win32":
1185.23.1 by Aaron Bentley
win32 setup fixes from Belchenko
56
            try:
57
                scripts_dir = self.install_dir
58
                script_path = os.path.join(scripts_dir, "bzr")
59
                batch_str = "@%s %s %%*\n" % (sys.executable, script_path)
60
                batch_path = script_path + ".bat"
61
                f = file(batch_path, "w")
62
                f.write(batch_str)
63
                f.close()
64
                print "Created:", batch_path
65
            except Exception, e:
66
                print "ERROR: Unable to create %s: %s" % (batch_path, e)
1185.1.40 by Robert Collins
Merge what applied of Alexander Belchenko's win32 patch.
67
68
1185.29.3 by Wouter van Heyst
Create bzr.1 manpage from setup.py
69
class bzr_build(build):
70
    """Customized build distutils action.
71
    Generate bzr.1.
72
    """
73
    def run(self):
74
        build.run(self)
75
1551.3.11 by Aaron Bentley
Merge from Robert
76
        import generate_docs
77
        generate_docs.main(argv=["bzr", "man"])
1185.29.3 by Wouter van Heyst
Create bzr.1 manpage from setup.py
78
1185.1.40 by Robert Collins
Merge what applied of Alexander Belchenko's win32 patch.
79
########################
80
## Setup
81
########################
82
1739.1.1 by Robert Collins
First cut at adding pyrex facilities.
83
command_classes = {'install_scripts': my_install_scripts,
84
                  'build': bzr_build}
85
ext_modules = []
86
try:
87
    from Pyrex.Distutils import build_ext
88
except ImportError:
89
    # try to build the extension from the prior generated source.
90
    print ("Pyrex not available, while bzr will build"
91
           ", you cannot modify the C extensions.")
92
    from distutils.command import build_ext
93
    from distutils.extension import Extension
1739.2.3 by Robert Collins
Add a replacement for os.listdir which returns file kind information from readdir when it is available. This drops our osutils.walkdirs time further, down to 77ms.
94
    ext_modules.append(
95
        Extension("bzrlib.readdir", ["bzrlib/readdir.c"], libraries = []))
1739.1.1 by Robert Collins
First cut at adding pyrex facilities.
96
    #ext_modules.append(
97
    #    Extension("bzrlib.modulename", ["bzrlib/foo.c"], libraries = []))
98
else:
99
    from distutils.extension import Extension
1739.2.3 by Robert Collins
Add a replacement for os.listdir which returns file kind information from readdir when it is available. This drops our osutils.walkdirs time further, down to 77ms.
100
    ext_modules.append(
101
        Extension("bzrlib.readdir", ["bzrlib/readdir.pyx"], libraries = []))
1739.1.1 by Robert Collins
First cut at adding pyrex facilities.
102
command_classes['build_ext'] = build_ext
103
104
45 by Martin Pool
- add setup.py and install instructions
105
setup(name='bzr',
1728.2.3 by Martin Pool
Fix up version in setup.py (matthieu)
106
      version='0.9pre',
1728.2.4 by Martin Pool
Change author to Canonical in setup.py
107
      author='Canonical Ltd',
108
      author_email='bazaar-ng@lists.ubuntu.com',
1728.2.3 by Martin Pool
Fix up version in setup.py (matthieu)
109
      url='http://bazaar-vcs.org/',
45 by Martin Pool
- add setup.py and install instructions
110
      description='Friendly distributed version control system',
111
      license='GNU GPL v2',
974.1.26 by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472
112
      packages=['bzrlib',
1530.2.1 by Robert Collins
Start tests for api usage.
113
                'bzrlib.doc',
114
                'bzrlib.doc.api',
1185.33.75 by Martin Pool
Include new submodules in setup.py list of modules.
115
                'bzrlib.export',
974.1.26 by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472
116
                'bzrlib.plugins',
1668.1.15 by Martin Pool
Fix setup.py to install launchpad plugin
117
                'bzrlib.plugins.launchpad',
1185.33.75 by Martin Pool
Include new submodules in setup.py list of modules.
118
                'bzrlib.store',
1594.2.13 by Robert Collins
update setup.py.
119
                'bzrlib.store.revision',
120
                'bzrlib.store.versioned',
1185.33.56 by Martin Pool
fixup setup.py for test renaming
121
                'bzrlib.tests',
1185.33.75 by Martin Pool
Include new submodules in setup.py list of modules.
122
                'bzrlib.tests.blackbox',
1616.1.14 by Martin Pool
Add missing selftest modules to setup.py
123
                'bzrlib.tests.branch_implementations',
124
                'bzrlib.tests.bzrdir_implementations',
125
                'bzrlib.tests.interrepository_implementations',
126
                'bzrlib.tests.interversionedfile_implementations',
127
                'bzrlib.tests.repository_implementations',
128
                'bzrlib.tests.revisionstore_implementations',
129
                'bzrlib.tests.workingtree_implementations',
1185.33.75 by Martin Pool
Include new submodules in setup.py list of modules.
130
                'bzrlib.transport',
1540.3.9 by Martin Pool
Make sure bzrlib.transport.http gets installed
131
                'bzrlib.transport.http',
1185.33.75 by Martin Pool
Include new submodules in setup.py list of modules.
132
                'bzrlib.ui',
974.1.26 by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472
133
                'bzrlib.util',
134
                'bzrlib.util.elementtree',
135
                'bzrlib.util.effbot.org',
1185.12.58 by Aaron Bentley
Included configobj in setup.py
136
                'bzrlib.util.configobj',
1185.82.130 by Aaron Bentley
Rename changesets to revision bundles
137
                'bzrlib.bundle',
138
                'bzrlib.bundle.serializer'
974.1.53 by aaron.bentley at utoronto
Disabled urlgrabber
139
                ],
1185.23.1 by Aaron Bentley
win32 setup fixes from Belchenko
140
      scripts=['bzr'],
1739.1.1 by Robert Collins
First cut at adding pyrex facilities.
141
      cmdclass=command_classes,
1185.29.3 by Wouter van Heyst
Create bzr.1 manpage from setup.py
142
      data_files=[('man/man1', ['bzr.1'])],
1739.1.1 by Robert Collins
First cut at adding pyrex facilities.
143
      ext_modules=ext_modules,
1530.2.1 by Robert Collins
Start tests for api usage.
144
    #   todo: install the txt files from bzrlib.doc.api.
1185.23.1 by Aaron Bentley
win32 setup fixes from Belchenko
145
     )