Mercurial > hg > PaInt
comparison paint/info.py @ 73:5b10f2c03cb9
more stubbing of something really stupid that is really hard
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sun, 27 Jan 2013 18:19:14 -0800 |
| parents | da69d58f960d |
| children | 84890934af1f |
comparison
equal
deleted
inserted
replaced
| 72:017b75cd61d8 | 73:5b10f2c03cb9 |
|---|---|
| 1 """ | 1 """ |
| 2 interfaces to get information from a package | 2 interfaces to get information from a package |
| 3 """ | 3 """ |
| 4 | |
| 4 | 5 |
| 5 import imp | 6 import imp |
| 6 import os | 7 import os |
| 7 import subprocess | 8 import subprocess |
| 8 import sys | 9 import sys |
| 9 | 10 |
| 11 from distutils.dist import Distribution | |
| 10 from distutils.dist import DistributionMetadata | 12 from distutils.dist import DistributionMetadata |
| 11 from subprocess import check_call as call | 13 from subprocess import check_call as call |
| 14 from StringIO import StringIO | |
| 12 | 15 |
| 13 # TODO: | 16 # TODO: |
| 14 # Reconcile the difference between the keys (and values) between the different | 17 # Reconcile the difference between the keys (and values) between the different |
| 15 # implementations. Pick a canon and stick with it. | 18 # implementations. Pick a canon and stick with it. |
| 16 | 19 |
| 24 # Metadata for Python Software Packages | 27 # Metadata for Python Software Packages |
| 25 | 28 |
| 26 | 29 |
| 27 # TODO: consider using pkginfo | 30 # TODO: consider using pkginfo |
| 28 | 31 |
| 29 def setup2metadata(**kwargs): | 32 def setup2metadata(**attrs): |
| 30 """ | 33 """ |
| 31 convert setup arguments to standard python metadata: | 34 convert setup arguments to standard python metadata: |
| 32 http://www.python.org/dev/peps/pep-0314/ | 35 http://www.python.org/dev/peps/pep-0314/ |
| 33 """ | 36 """ |
| 34 metadata = DistributionMetadata() | 37 distribution = Distribution(kwargs) |
| 38 buffer = StringIO() | |
| 39 distribution.metadata.write_pkg_file(buffer) | |
| 35 raise NotImplementedError("TODO") | 40 raise NotImplementedError("TODO") |
| 36 | 41 |
| 37 | 42 |
| 38 class PackageInfo(object): | 43 class PackageInfo(object): |
| 39 """abstract base class of package info""" | 44 """abstract base class of package info""" |
| 47 self.setup_py = os.path.abspath(path) | 52 self.setup_py = os.path.abspath(path) |
| 48 | 53 |
| 49 def __call__(self): | 54 def __call__(self): |
| 50 """returns dictionary of package info""" | 55 """returns dictionary of package info""" |
| 51 raise NotImplementedError("abstract base class") | 56 raise NotImplementedError("abstract base class") |
| 52 | |
| 53 def dependencies(self): | 57 def dependencies(self): |
| 54 raise NotImplementedError("abstract base class") | 58 raise NotImplementedError("abstract base class") |
| 55 | 59 |
| 56 class SetupOverridePackageInfo(PackageInfo): | 60 class SetupOverridePackageInfo(PackageInfo): |
| 57 """ | 61 """ |
