Merge lp:~ed.so/duplicity/setup.shebang into lp:~duplicity-team/duplicity/0.7-series

Proposed by edso
Status: Merged
Merged at revision: 1138
Proposed branch: lp:~ed.so/duplicity/setup.shebang
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 71 lines (+43/-3)
1 file modified
setup.py (+43/-3)
To merge this branch: bzr merge lp:~ed.so/duplicity/setup.shebang
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+275693@code.launchpad.net

Description of the change

having the python interpreter searched in the PATH is much more flexible than the /usr/bin/python inserted into our scripts shebang by setuptools.

this patch prevents that. don't touch my shebang! :)

To post a comment you must log in.
lp:~ed.so/duplicity/setup.shebang updated
1137. By edso

also check python version number upper bound. we run on 2.6 and 2.7 currently

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'setup.py'
--- setup.py 2015-02-01 17:37:37 +0000
+++ setup.py 2015-10-26 15:47:21 +0000
@@ -26,11 +26,12 @@
26from setuptools.command.test import test26from setuptools.command.test import test
27from setuptools.command.install import install27from setuptools.command.install import install
28from setuptools.command.sdist import sdist28from setuptools.command.sdist import sdist
29from distutils.command.build_scripts import build_scripts
2930
30version_string = "$version"31version_string = "$version"
3132
32if sys.version_info[:2] < (2, 6):33if sys.version_info[:2] < (2, 6) or sys.version_info[:2] > (2, 7):
33 print("Sorry, duplicity requires version 2.6 or later of python")34 print("Sorry, duplicity requires version 2.6 or 2.7 of python.")
34 sys.exit(1)35 sys.exit(1)
3536
36incdir_list = libdir_list = None37incdir_list = libdir_list = None
@@ -122,6 +123,44 @@
122 os.system("mkdir -p " + self.dist_dir)123 os.system("mkdir -p " + self.dist_dir)
123 os.system("mv duplicity-" + version + ".tar.gz " + self.dist_dir)124 os.system("mv duplicity-" + version + ".tar.gz " + self.dist_dir)
124125
126# don't touch my shebang
127class BSCommand (build_scripts):
128 def run(self):
129 """
130 Copy, chmod each script listed in 'self.scripts'
131 essentially this is the stripped
132 distutils.command.build_scripts.copy_scripts()
133 routine
134 """
135 from stat import ST_MODE
136 from distutils.dep_util import newer
137 from distutils import log
138
139 self.mkpath(self.build_dir)
140 outfiles = []
141 for script in self.scripts:
142 outfile = os.path.join(self.build_dir, os.path.basename(script))
143 outfiles.append(outfile)
144
145 if not self.force and not newer(script, outfile):
146 log.debug("not copying %s (up-to-date)", script)
147 continue
148
149 log.info("copying and NOT adjusting %s -> %s", script,
150 self.build_dir)
151 self.copy_file(script, outfile)
152
153 if os.name == 'posix':
154 for file in outfiles:
155 if self.dry_run:
156 log.info("changing mode of %s", file)
157 else:
158 oldmode = os.stat(file)[ST_MODE] & 0o7777
159 newmode = (oldmode | 0o555) & 0o7777
160 if newmode != oldmode:
161 log.info("changing mode of %s from %o to %o",
162 file, oldmode, newmode)
163 os.chmod(file, newmode)
125164
126setup(name="duplicity",165setup(name="duplicity",
127 version=version_string,166 version=version_string,
@@ -151,5 +190,6 @@
151 test_suite='testing',190 test_suite='testing',
152 cmdclass={'test': TestCommand,191 cmdclass={'test': TestCommand,
153 'install': InstallCommand,192 'install': InstallCommand,
154 'sdist': SDistCommand},193 'sdist': SDistCommand,
194 'build_scripts': BSCommand},
155 )195 )

Subscribers

People subscribed via source and target branches