Mercurial > hg > PaInt
annotate paint/package.py @ 67:8f39ba642531
random stubbing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 25 Jan 2013 15:56:26 -0800 |
parents | af7609457dc6 |
children | d001017d5870 |
rev | line source |
---|---|
4 | 1 """ |
2 package model for python PAckage INTrospection | |
3 """ | |
4 | |
36 | 5 # TODO: use pkginfo.sdist more |
6 | |
57 | 7 import info |
7 | 8 import os |
28 | 9 import pip |
9
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
10 import shutil |
19 | 11 import subprocess |
12 import sys | |
7 | 13 import tarfile |
5 | 14 import tempfile |
7 | 15 import urllib2 |
21
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
16 import urlparse |
7 | 17 import utils |
5 | 18 |
62
726008cff4e3
remove code supporting old version
Jeff Hammel <jhammel@mozilla.com>
parents:
58
diff
changeset
|
19 from subprocess import check_call as call |
19 | 20 |
10 | 21 __all__ = ['Package'] |
22 | |
4 | 23 class Package(object): |
33 | 24 """ |
25 class for python package introspection. | |
26 constructor takes the package 'src' | |
27 """ | |
4 | 28 |
50 | 29 def __init__(self, src, verbose=True): |
63 | 30 """ |
31 - src : URL or filesystem path to the package | |
32 """ | |
4 | 33 self.src = src |
50 | 34 self.verbose = verbose |
13
0dd1f8f83be2
moving towards some sort of organization
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
35 |
0dd1f8f83be2
moving towards some sort of organization
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
36 # ephemeral data |
5 | 37 self._tmppath = None |
28 | 38 self._egg_info_path = None |
33 | 39 self._build_path = None |
40
06f21791eba1
add yet another indirection layer
Jeff Hammel <jhammel@mozilla.com>
parents:
39
diff
changeset
|
40 self._pkg_info_path = None |
5 | 41 |
64
1a279bac0afa
start moving this monster to a package information provider
Jeff Hammel <jhammel@mozilla.com>
parents:
63
diff
changeset
|
42 # package metadata provider |
1a279bac0afa
start moving this monster to a package information provider
Jeff Hammel <jhammel@mozilla.com>
parents:
63
diff
changeset
|
43 # TODO: this should be chooseable but currently the keys of the |
1a279bac0afa
start moving this monster to a package information provider
Jeff Hammel <jhammel@mozilla.com>
parents:
63
diff
changeset
|
44 # interfaces are not the same |
1a279bac0afa
start moving this monster to a package information provider
Jeff Hammel <jhammel@mozilla.com>
parents:
63
diff
changeset
|
45 self.package_info = info.EggInfo |
1a279bac0afa
start moving this monster to a package information provider
Jeff Hammel <jhammel@mozilla.com>
parents:
63
diff
changeset
|
46 |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
47 # TODO: list of temporary files/directories to be deleted |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
48 |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
49 def _log(self, message): |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
50 if self.verbose: |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
51 print '>>> %s' % message |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
52 |
34 | 53 def _path(self): |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
54 """filesystem path to package directory""" |
7 | 55 |
51 | 56 self._log(">>> _path:Getting path to package") |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
57 |
7 | 58 # return cached copy if it exists |
59 if self._tmppath: | |
60 return self._tmppath | |
61 | |
62 # fetch from the web if a URL | |
63 tmpfile = None | |
64 src = self.src | |
5 | 65 if utils.isURL(self.src): |
8 | 66 tmpfile = src = self.fetch() |
7 | 67 |
68 # unpack if an archive | |
28 | 69 if self._is_archive(src): |
8 | 70 try: |
37 | 71 self._unpack(src) |
8 | 72 finally: |
73 if tmpfile: | |
74 os.remove(tmpfile) | |
7 | 75 return self._tmppath |
76 | |
5 | 77 return self.src |
78 | |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
79 def fetch(self, filename=None): |
8 | 80 """fetch from remote source to a temporary file""" |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
81 if filename is None: |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
82 fd, filename = tempfile.mkstemp() |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
83 os.close(fd) |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
84 fp = file(filename, 'w') |
15
8c8b7482772f
fix a few failures but still failing
Jeff Hammel <jhammel@mozilla.com>
parents:
14
diff
changeset
|
85 resource = urllib2.urlopen(self.src) |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
86 fp.write(resource.read()) |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
87 fp.close() |
7 | 88 return filename |
89 | |
37 | 90 def _unpack(self, archive): |
7 | 91 """unpack the archive to a temporary destination""" |
92 # TODO: should handle zipfile additionally at least | |
93 # Ideally, this would be pluggable, etc | |
8 | 94 assert tarfile.is_tarfile(archive), "%s is not an archive" % self.src |
9
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
95 tf = tarfile.TarFile.open(archive) |
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
96 self._tmppath = tempfile.mkdtemp() |
19 | 97 members = tf.getmembers() |
98 | |
99 # cut off the top level directory | |
37 | 100 members = [i for i in members if os.path.sep in i.name] |
19 | 101 tld = set() |
102 for member in members: | |
103 directory, member.name = member.name.split(os.path.sep, 1) | |
104 tld.add(directory) | |
105 assert len(tld) == 1 | |
106 | |
107 # extract | |
108 for member in members: | |
109 tf.extract(member, path=self._tmppath) | |
110 tf.close() | |
7 | 111 |
28 | 112 def _is_archive(self, path): |
7 | 113 """returns if the filesystem path is an archive""" |
114 # TODO: should handle zipfile additionally at least | |
115 # Ideally, this would be pluggable, etc | |
116 return tarfile.is_tarfile(path) | |
9
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
117 |
28 | 118 def _cleanup(self): |
9
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
119 if self._tmppath: |
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
120 shutil.rmtree(self._tmppath) |
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
121 self._tmppath = None |
562230cc2e86
now the package class should at least extracts things. it doesnt actually do anything useful
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
122 |
65 | 123 __del__ = _cleanup |
11 | 124 |
13
0dd1f8f83be2
moving towards some sort of organization
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
125 ### python-package-specific functionality |
0dd1f8f83be2
moving towards some sort of organization
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
126 |
40
06f21791eba1
add yet another indirection layer
Jeff Hammel <jhammel@mozilla.com>
parents:
39
diff
changeset
|
127 def info(self): |
06f21791eba1
add yet another indirection layer
Jeff Hammel <jhammel@mozilla.com>
parents:
39
diff
changeset
|
128 """return info dictionary for package""" |
06f21791eba1
add yet another indirection layer
Jeff Hammel <jhammel@mozilla.com>
parents:
39
diff
changeset
|
129 # could use pkginfo module |
06f21791eba1
add yet another indirection layer
Jeff Hammel <jhammel@mozilla.com>
parents:
39
diff
changeset
|
130 |
53
c588375a7ce4
starting a new strawman to work out kinks
Jeff Hammel <jhammel@mozilla.com>
parents:
52
diff
changeset
|
131 self._log(">>> Getting the info") |
66
af7609457dc6
introduce a failing test; yay!
Jeff Hammel <jhammel@mozilla.com>
parents:
65
diff
changeset
|
132 return self.package_info(self._path())() |
13
0dd1f8f83be2
moving towards some sort of organization
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
133 |
11 | 134 def dependencies(self): |
14
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
135 """return the dependencies""" |
32 | 136 # TODO: should probably have a more detailed dict: |
137 # {'mozinfo': {'version': '>= 0.2', | |
138 # 'url': 'http://something.com/'}} | |
21
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
139 # get the egg_info directory |
28 | 140 egg_info = self._egg_info() |
14
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
141 |
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
142 # read the dependencies |
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
143 requires = os.path.join(egg_info, 'requires.txt') |
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
144 if os.path.exists(requires): |
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
145 dependencies = [i.strip() for i in file(requires).readlines() if i.strip()] |
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
146 else: |
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
147 dependencies = [] |
21
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
148 dependencies = dict([(i, None) for i in dependencies]) |
14
6d27c2136163
a decent structure; need to reuse more
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
149 |
21
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
150 # read the dependency links |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
151 dependency_links = os.path.join(egg_info, 'dependency_links.txt') |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
152 if os.path.exists(dependency_links): |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
153 links = [i.strip() for i in file(dependency_links).readlines() if i.strip()] |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
154 for link in links: |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
155 # XXX pretty ghetto |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
156 assert '#egg=' in link |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
157 url, dep = link.split('#egg=', 1) |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
158 if dep in dependencies: |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
159 dependencies[dep] = link |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
160 |
4df3e715817d
now have passing tests again
Jeff Hammel <jhammel@mozilla.com>
parents:
20
diff
changeset
|
161 return dependencies |
24 | 162 |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
163 def extension(self): |
35 | 164 """filename extension of the package""" |
165 | |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
166 print ">>> extension:Getting package" |
35 | 167 package = self.package() |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
168 print ">>> extension:package=%s" % package |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
169 |
35 | 170 # determine the extension (XXX hacky) |
171 extensions = ('.tar.gz', '.zip', '.tar.bz2') | |
172 for ext in extensions: | |
36 | 173 if package.endswith(ext): |
35 | 174 return ext |
175 | |
176 raise Exception("Extension %s not found: %s" % (extensions, package)) | |
177 | |
178 def package(self, destination=None): | |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
179 """ |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
180 repackage the package to ensure its actually in the right form |
34 | 181 and return the path to the destination |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
182 - destination: if given, path to put the build in |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
183 """ |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
184 |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
185 self._log("package: Getting package directory, destination=%s" % repr(destination)) |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
186 |
33 | 187 if self._build_path: |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
188 self._log("package: build_path already set: %s" % self._build_path) |
34 | 189 if destination: |
190 shutil.copy(self._build_path, destination) | |
191 return os.path.abspath(destination) | |
192 | |
193 # return cached copy | |
33 | 194 return self._build_path |
195 | |
34 | 196 path = self._path() |
197 dist = os.path.join(path, 'dist') | |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
198 self._log("package: dist directory: %s; (path=%s)" % (dist, path)) |
34 | 199 if os.path.exists(dist): |
200 shutil.rmtree(dist) | |
201 | |
49
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
202 command = [sys.executable, 'setup.py', 'sdist'] |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
203 self._log("package: running: %s" % ' '.join(command)) |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
204 call(command, cwd=path) |
85374a69cf89
call in foreground to avoid hang :(
Jeff Hammel <jhammel@mozilla.com>
parents:
48
diff
changeset
|
205 self._log("package: done running setup.py dist") |
34 | 206 |
207 assert os.path.exists(dist) | |
208 contents = os.listdir(dist) | |
209 assert len(contents) == 1 | |
210 | |
211 self._build_path = os.path.join(dist, contents[0]) | |
212 | |
213 # destination | |
214 # use an evil recursive trick | |
215 if destination: | |
36 | 216 return self.package(destination=destination) |
34 | 217 |
218 return self._build_path | |
219 | |
24 | 220 def download(self, directory): |
221 """download a package and all its dependencies using pip""" | |
28 | 222 if not os.path.exists(directory): |
223 os.makedirs(directory) | |
224 assert os.path.isdir(directory) | |
225 pip.main(['install', '--download', directory, self.src]) | |
226 | |
227 def pypi(self, directory): | |
228 """ | |
229 download packages for a pypi directory structure | |
230 http://k0s.org/portfolio/pypi.html | |
231 """ | |
29
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
232 if not os.path.exists(directory): |
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
233 os.makedirs(directory) |
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
234 assert os.path.isdir(directory) |
28 | 235 tempdir = tempfile.mkdtemp() |
236 try: | |
29
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
237 self.download(tempdir) |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
238 files = os.listdir(tempdir) |
52 | 239 self._log(">>> Files: %s" % files) |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
240 for f in files: |
29
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
241 |
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
242 # full path |
47 | 243 src = os.path.join(tempdir, f) |
29
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
244 |
35 | 245 # make a package of the thing |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
246 print ">>> pypi:Packaging %s" % src |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
247 package = Package(src) |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
248 print ">>> pypi:DONE packaging %s" % src |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
249 |
36 | 250 # get destination dirname, filename |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
251 print ">>> pypi:Getting PyPI path" |
36 | 252 dirname, filename = package.pypi_path() |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
253 print ">>> pypi:DONE PyPI path: %s/%s" % (dirname, filename) |
29
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
254 |
36 | 255 # make the directory if it doesn't exist |
256 subdir = os.path.join(directory, dirname) | |
257 if not os.path.exists(subdir): | |
258 os.makedirs(subdir) | |
259 assert os.path.isdir(subdir) | |
29
59524b6d25c0
implementing making pypi directory strcuture from a package
Jeff Hammel <jhammel@mozilla.com>
parents:
28
diff
changeset
|
260 |
36 | 261 # move the file |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
262 print ">>> pypi:Moving to PyPI path %s/%s" % (subdir, filename) |
47 | 263 package.package(destination=os.path.join(subdir, filename)) |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
264 print ">>> Done with %s" % src |
28 | 265 finally: |
266 shutil.rmtree(tempdir) | |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
267 |
36 | 268 def pypi_path(self): |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
269 """ |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
270 returns subpath 2-tuple appropriate for pypi path structure: |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
271 http://k0s.org/portfolio/pypi.html |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
272 """ |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
273 print ">>> pypi_path:Getting info" |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
274 info = self.info() |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
275 print ">>> pypi_path:DONE getting info" |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
276 |
36 | 277 # determine the extension |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
278 print ">>> pypi_path:Getting extension" |
36 | 279 extension = self.extension() |
48
abfb267e8332
debugging info; lord i hate this
Jeff Hammel <jhammel@mozilla.com>
parents:
47
diff
changeset
|
280 print ">>> pypi_path:DONE Getting extension: %s" % extension |
31
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
281 |
5fb1844db0b2
back to the drawring broad
Jeff Hammel <jhammel@mozilla.com>
parents:
30
diff
changeset
|
282 # get the filename destination |
36 | 283 name = info['Name'] |
284 version = info['Version'] | |
285 filename = '%s-%s%s' % (name, version, extension) | |
286 return name, filename |