~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-30 16:57:40 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060730165740-b3ce4419930f549b
setup.py: improved bzr.bat creation

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
        if sys.platform == "win32":
104
104
            try:
105
105
                scripts_dir = self.install_dir
106
 
                script_path = os.path.join(scripts_dir, "bzr")
107
 
                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)
108
111
                batch_path = script_path + ".bat"
109
112
                f = file(batch_path, "w")
110
113
                f.write(batch_str)
113
116
            except Exception, e:
114
117
                print "ERROR: Unable to create %s: %s" % (batch_path, e)
115
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
 
116
132
 
117
133
class bzr_build(build):
118
134
    """Customized build distutils action.