diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2018-05-19 21:15:23 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2018-05-19 21:15:23 +0200 |
commit | de0bed4fc96330b021cbee63dc4f3a5eae2549c5 (patch) | |
tree | ffcddbe15f0776094e3628b1e7f49497de4b32f4 /src/setuptools_scm/hacks.py | |
parent | 883e9f09258ba1253feaad03464f5663249f9ee1 (diff) | |
download | setuptools-scm-de0bed4fc96330b021cbee63dc4f3a5eae2549c5.tar.gz |
switch to src/ layout
this also sorts out #262
Diffstat (limited to 'src/setuptools_scm/hacks.py')
-rw-r--r-- | src/setuptools_scm/hacks.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/setuptools_scm/hacks.py b/src/setuptools_scm/hacks.py new file mode 100644 index 0000000..2386389 --- /dev/null +++ b/src/setuptools_scm/hacks.py @@ -0,0 +1,24 @@ +import os +from .utils import data_from_mime, trace +from .version import meta + + +def parse_pkginfo(root): + + pkginfo = os.path.join(root, "PKG-INFO") + trace("pkginfo", pkginfo) + data = data_from_mime(pkginfo) + version = data.get("Version") + if version != "UNKNOWN": + return meta(version, preformatted=True) + + +def parse_pip_egg_info(root): + pipdir = os.path.join(root, "pip-egg-info") + if not os.path.isdir(pipdir): + return + items = os.listdir(pipdir) + trace("pip-egg-info", pipdir, items) + if not items: + return + return parse_pkginfo(os.path.join(pipdir, items[0])) |