forked from ungleich-public/cdist
Merge branch 'build/support-pip-from-git' into 'master'
Build/support pip from git See merge request ungleich-public/cdist!808
This commit is contained in:
commit
2a4efb84c5
1 changed files with 21 additions and 1 deletions
22
setup.py
22
setup.py
|
@ -1,7 +1,27 @@
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
import cdist
|
from distutils.errors import DistutilsError
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
# We have it only if it is a git cloned repo.
|
||||||
|
build_helper = os.path.join('bin', 'build-helper')
|
||||||
|
# Version file path.
|
||||||
|
version_file = os.path.join('cdist', 'version.py')
|
||||||
|
# If we have build-helper we could be a git repo.
|
||||||
|
if os.path.exists(build_helper):
|
||||||
|
# Try to generate version.py.
|
||||||
|
rv = subprocess.run([build_helper, 'version', ])
|
||||||
|
if rv.returncode != 0:
|
||||||
|
raise DistutilsError("Failed to generate {}".format(version_file))
|
||||||
|
else:
|
||||||
|
# Otherwise, version.py should be present.
|
||||||
|
if not os.path.exists(version_file):
|
||||||
|
raise DistutilsError("Missing version file {}".format(version_file))
|
||||||
|
|
||||||
|
|
||||||
|
import cdist
|
||||||
|
|
||||||
|
|
||||||
def data_finder(data_dir):
|
def data_finder(data_dir):
|
||||||
|
|
Loading…
Reference in a new issue