aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2018-06-06 12:10:02 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2018-06-06 12:10:02 -0400
commit85cc0cc947e6ab5fd96c286f12dbc187cbbea986 (patch)
tree3370fadd86af3f2d2c2eda24b1105213ad27e5d5
parente50b00127a9c1ec25ba1f8133551a0ff682d60a2 (diff)
downloadfirewatch-85cc0cc947e6ab5fd96c286f12dbc187cbbea986.tar.gz
Minor bugfix(s)
* Update RELIC * Exclude generated cruft from sdist
-rw-r--r--MANIFEST.in3
-rw-r--r--setup.py32
2 files changed, 19 insertions, 16 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 423c68c..15bc3da 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
include RELIC-INFO
-recursive-include firewatch *
+global-exclude __pycache__
+global-exclude *.py[co]
diff --git a/setup.py b/setup.py
index c3c9b08..7a20fab 100644
--- a/setup.py
+++ b/setup.py
@@ -1,27 +1,29 @@
import os
-import subprocess
+import pkgutil
import sys
from setuptools import setup, find_packages
+from subprocess import check_call, CalledProcessError
PACKAGENAME='firewatch'
-if os.path.exists('relic'):
- sys.path.insert(1, 'relic')
- import relic.release
-else:
+if not pkgutil.find_loader('relic'):
+ relic_local = os.path.exists('relic')
+ relic_submodule = (relic_local and
+ os.path.exists('.gitmodules') and
+ not os.listdir('relic'))
try:
- import relic.release
- except ImportError:
- try:
- subprocess.check_call(['git', 'clone',
- 'https://github.com/jhunkeler/relic.git'])
- sys.path.insert(1, 'relic')
- import relic.release
- except subprocess.CalledProcessError as e:
- print(e)
- exit(1)
+ if relic_submodule:
+ check_call(['git', 'submodule', 'update', '--init', '--recursive'])
+ elif not relic_local:
+ check_call(['git', 'clone', 'https://github.com/spacetelescope/relic.git'])
+ sys.path.insert(1, 'relic')
+ except CalledProcessError as e:
+ print(e)
+ exit(1)
+
+import relic.release
version = relic.release.get_info()
relic.release.write_template(version, PACKAGENAME)