~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Martin Pool
  • Date: 2005-09-30 06:39:42 UTC
  • mfrom: (1185.10.11)
  • mto: (1185.14.2)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: mbp@sourcefrog.net-20050930063942-3eab86500bffba49
- merge merge and export fixes from aaron
aaron.bentley@utoronto.ca-20050930040234-71c1a151f795e806

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# './setup.py --help' for more options
6
6
 
7
7
from distutils.core import setup
8
 
from distutils.command.install_scripts import install_scripts
 
8
 
 
9
# more sophisticated setup script, based on pychecker setup.py
 
10
import sys, os
 
11
from distutils.command.build_scripts import build_scripts
9
12
 
10
13
 
11
14
###############################
12
15
# Overridden distutils actions
13
16
###############################
14
17
 
15
 
class my_install_scripts(install_scripts):
16
 
    """ Customized install_scripts distutils action.
 
18
class my_build_scripts(build_scripts):
 
19
    """Customized build_scripts distutils action.
 
20
 
17
21
    Create bzr.bat for win32.
18
22
    """
 
23
 
19
24
    def run(self):
20
 
        import os
21
 
        import sys
22
 
 
23
 
        install_scripts.run(self)   # standard action
24
 
 
25
25
        if sys.platform == "win32":
26
 
            try:
27
 
                scripts_dir = self.install_dir
28
 
                script_path = os.path.join(scripts_dir, "bzr")
29
 
                batch_str = "@%s %s %%*\n" % (sys.executable, script_path)
30
 
                batch_path = script_path + ".bat"
31
 
                f = file(batch_path, "w")
32
 
                f.write(batch_str)
33
 
                f.close()
34
 
                print "Created:", batch_path
35
 
            except Exception, e:
36
 
                print "ERROR: Unable to create %s: %s" % (batch_path, e)
 
26
            bat_path = os.path.join(self.build_dir, "bzr.bat")
 
27
            self.scripts.append(bat_path)
 
28
            self.mkpath(self.build_dir)
 
29
            scripts_dir = self.distribution.get_command_obj("install").\
 
30
                                                            install_scripts
 
31
            self.execute(func=self._create_bat,
 
32
                         args=[bat_path, scripts_dir],
 
33
                         msg="Create %s" % bat_path)
 
34
        build_scripts.run(self) # invoke "standard" action
 
35
 
 
36
    def _create_bat(self, bat_path, scripts_dir):
 
37
        """ Creates the batch file for bzr on win32.
 
38
        """
 
39
        try:
 
40
            script_path = os.path.join(scripts_dir, "bzr")
 
41
            bat_str = "@%s %s %%*\n" % (sys.executable, script_path)
 
42
            file(bat_path, "w").write(bat_str)
 
43
            print "file written"
 
44
        except Exception, e:
 
45
            print "ERROR: Unable to create %s: %s" % (bat_path, e)
 
46
            raise e
37
47
 
38
48
 
39
49
########################
41
51
########################
42
52
 
43
53
setup(name='bzr',
44
 
      version='0.1',
 
54
      version='0.0.6',
45
55
      author='Martin Pool',
46
56
      author_email='mbp@sourcefrog.net',
47
57
      url='http://www.bazaar-ng.org/',
51
61
                'bzrlib.plugins',
52
62
                'bzrlib.selftest',
53
63
                'bzrlib.util',
54
 
                'bzrlib.transport',
55
 
                'bzrlib.store',
56
64
                'bzrlib.util.elementtree',
57
65
                'bzrlib.util.effbot.org',
58
 
                'bzrlib.util.configobj',
59
66
                ],
60
 
      scripts=['bzr'],
61
 
      cmdclass={'install_scripts': my_install_scripts},
62
 
     )
 
67
      scripts=['bzr'])