Merge lp:~ted/snapcraft/cmdline-exec into lp:~ted/snapcraft/python-pip

Proposed by Ted Gould
Status: Superseded
Proposed branch: lp:~ted/snapcraft/cmdline-exec
Merge into: lp:~ted/snapcraft/python-pip
Diff against target: 89 lines (+39/-2)
3 files modified
snapcraft/plugins/python2_project.py (+17/-1)
snapcraft/plugins/python3_project.py (+18/-1)
snapcraft/yaml.py (+4/-0)
To merge this branch: bzr merge lp:~ted/snapcraft/cmdline-exec
Reviewer Review Type Date Requested Status
Ted Gould Pending
Review via email: mp+271697@code.launchpad.net

This proposal has been superseded by a proposal from 2015-09-18.

Commit message

Wrap setup.py calls to configure the shebang writer

To post a comment you must log in.
lp:~ted/snapcraft/cmdline-exec updated
173. By Ted Gould

Merge trunk

174. By Ted Gould

Import tempfile

Unmerged revisions

174. By Ted Gould

Import tempfile

173. By Ted Gould

Merge trunk

172. By Ted Gould

Port over to the python2 project

171. By Ted Gould

Have a temporary setup.py to set the executable

170. By Ted Gould

Update to trunk and python-pip

169. By Ted Gould

We want some PIP!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snapcraft/plugins/python2_project.py'
--- snapcraft/plugins/python2_project.py 2015-09-17 15:03:38 +0000
+++ snapcraft/plugins/python2_project.py 2015-09-18 18:02:22 +0000
@@ -33,12 +33,28 @@
33 # and be in the PYTHONPATH. It's harmless if setuptools isn't33 # and be in the PYTHONPATH. It's harmless if setuptools isn't
34 # used.34 # used.
35 os.makedirs(self.dist_packages_dir, exist_ok=True)35 os.makedirs(self.dist_packages_dir, exist_ok=True)
36 setuptemp = self.copy_setup()
3637
37 return self.run(38 return self.run(
38 ['python2', 'setup.py', 'install', '--install-layout=deb',39 ['python2', setuptemp.name, 'install', '--install-layout=deb',
39 '--prefix={}/usr'.format(self.installdir)])40 '--prefix={}/usr'.format(self.installdir)])
4041
41 @property42 @property
42 def dist_packages_dir(self):43 def dist_packages_dir(self):
43 return os.path.join(44 return os.path.join(
44 self.installdir, 'usr', 'lib', 'python2.7', 'dist-packages')45 self.installdir, 'usr', 'lib', 'python2.7', 'dist-packages')
46
47 # Takes the setup.py file and puts a couple little gems on the
48 # front to make things work better.
49 def copy_setup(self):
50 setupout = tempfile.NamedTemporaryFile(mode='w+')
51
52 setupout.write('import sys\n')
53 setupout.write('sys.executable = "usr/bin/python2"\n\n')
54
55 with open('setup.py', 'r') as f:
56 for line in f:
57 setupout.write(line)
58
59 setupout.flush()
60 return setupout
4561
=== modified file 'snapcraft/plugins/python3_project.py'
--- snapcraft/plugins/python3_project.py 2015-09-18 03:23:38 +0000
+++ snapcraft/plugins/python3_project.py 2015-09-18 18:02:22 +0000
@@ -15,6 +15,7 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os17import os
18import tempfile
1819
19import snapcraft20import snapcraft
2021
@@ -37,11 +38,27 @@
37 # and be in the PYTHONPATH. It's harmless if setuptools isn't38 # and be in the PYTHONPATH. It's harmless if setuptools isn't
38 # used.39 # used.
39 os.makedirs(self.dist_packages_dir, exist_ok=True)40 os.makedirs(self.dist_packages_dir, exist_ok=True)
41 setuptemp = self.copy_setup()
40 return self.run(42 return self.run(
41 ['python3', 'setup.py', 'install', '--install-layout=deb',43 ['python3', setuptemp.name, 'install', '--install-layout=deb',
42 '--prefix=%s/usr' % self.installdir])44 '--prefix=%s/usr' % self.installdir])
4345
44 @property46 @property
45 def dist_packages_dir(self):47 def dist_packages_dir(self):
46 return os.path.join(48 return os.path.join(
47 self.installdir, 'usr', 'lib', 'python3', 'dist-packages')49 self.installdir, 'usr', 'lib', 'python3', 'dist-packages')
50
51 # Takes the setup.py file and puts a couple little gems on the
52 # front to make things work better.
53 def copy_setup(self):
54 setupout = tempfile.NamedTemporaryFile(mode='w+')
55
56 setupout.write('import sys\n')
57 setupout.write('sys.executable = "usr/bin/python3"\n\n')
58
59 with open('setup.py', 'r') as f:
60 for line in f:
61 setupout.write(line)
62
63 setupout.flush()
64 return setupout
4865
=== modified file 'snapcraft/yaml.py'
--- snapcraft/yaml.py 2015-09-18 03:23:38 +0000
+++ snapcraft/yaml.py 2015-09-18 18:02:22 +0000
@@ -181,6 +181,10 @@
181181
182 env = []182 env = []
183183
184 env += part.env(part.installdir)
185 env += self.runtime_env(part.installdir)
186 env += self.build_env(part.installdir)
187
184 for dep in part.deps:188 for dep in part.deps:
185 root = dep.installdir189 root = dep.installdir
186 env += dep.env(root)190 env += dep.env(root)

Subscribers

People subscribed via source and target branches

to all changes: