summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2017-09-27 14:32:07 +0100
committerTristan Maat <tristan.maat@codethink.co.uk>2017-09-28 14:46:35 +0100
commite8beece45b7de0ee0de4db2254a4e40b44bc8b58 (patch)
tree3e60a58d0aa6a2029d577220b4e328815e24bc6f
parent4f814b1eed2aacf877c00e4d5aa41639c6f1afad (diff)
downloadbuildstream-cross_platform.tar.gz
setup.py: Make setup.py work on non-linuxcross_platform
-rw-r--r--.gitlab-ci.yml2
-rwxr-xr-xsetup.py54
2 files changed, 30 insertions, 26 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c3526fa36..4bdc62871 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -103,7 +103,7 @@ coverage:
- cd report
- cp ../coverage-linux/coverage.linux .coverage
- cp ../coverage-unix/coverage.unix .
- - coverage combine --rcfile=../coveragerc -a ../coverage-unix/coverage.unix
+ - coverage combine --rcfile=../.coveragerc -a ../coverage-unix/coverage.unix
- cp ../coverage-pytest/coverage.pytest .
- coverage combine --rcfile=../.coveragerc -a coverage.pytest
- cp ../coverage-pytest-unix/coverage.pytest-unix .
diff --git a/setup.py b/setup.py
index 953485dc9..2022e6cbb 100755
--- a/setup.py
+++ b/setup.py
@@ -26,12 +26,14 @@ if sys.version_info[0] != 3 or sys.version_info[1] < 4:
print("BuildStream requires Python >= 3.4")
sys.exit(1)
-bwrap_path = shutil.which('bwrap')
-if not bwrap_path:
- print("Bubblewrap not found: BuildStream requires Bubblewrap (bwrap) for"
- " sandboxing the build environment. Install it using your package manager"
- " (usually bwrap or bubblewrap)")
- sys.exit(1)
+platform = os.environ.get('BST_FORCE_BACKEND', '') or sys.platform
+if platform.startswith('linux'):
+ bwrap_path = shutil.which('bwrap')
+ if not bwrap_path:
+ print("Bubblewrap not found: BuildStream requires Bubblewrap (bwrap) for"
+ " sandboxing the build environment. Install it using your package manager"
+ " (usually bwrap or bubblewrap)")
+ sys.exit(1)
try:
from setuptools import setup, find_packages
@@ -56,27 +58,29 @@ def exit_ostree(reason):
"Install it using your package manager (usually ostree or gir1.2-ostree-1.0).")
sys.exit(1)
-try:
- import gi
-except ImportError:
- print("BuildStream requires PyGObject (aka PyGI). Install it using"
- " your package manager (usually pygobject3 or python-gi).")
- sys.exit(1)
+if platform.startswith('linux'):
+ try:
+ import gi
+ except ImportError:
+ print("BuildStream requires PyGObject (aka PyGI). Install it using"
+ " your package manager (usually pygobject3 or python-gi).")
+ sys.exit(1)
-try:
- gi.require_version('OSTree', '1.0')
- from gi.repository import OSTree
-except:
- exit_ostree("OSTree not found")
+if platform.startswith('linux'):
+ try:
+ gi.require_version('OSTree', '1.0')
+ from gi.repository import OSTree
+ except:
+ exit_ostree("OSTree not found")
-try:
- if OSTree.YEAR_VERSION < REQUIRED_OSTREE_YEAR or \
- (OSTree.YEAR_VERSION == REQUIRED_OSTREE_YEAR and
- OSTree.RELEASE_VERSION < REQUIRED_OSTREE_RELEASE):
- exit_ostree("OSTree v{}.{} is too old."
- .format(OSTree.YEAR_VERSION, OSTree.RELEASE_VERSION))
-except AttributeError:
- exit_ostree("OSTree is too old.")
+ try:
+ if OSTree.YEAR_VERSION < REQUIRED_OSTREE_YEAR or \
+ (OSTree.YEAR_VERSION == REQUIRED_OSTREE_YEAR and
+ OSTree.RELEASE_VERSION < REQUIRED_OSTREE_RELEASE):
+ exit_ostree("OSTree v{}.{} is too old."
+ .format(OSTree.YEAR_VERSION, OSTree.RELEASE_VERSION))
+ except AttributeError:
+ exit_ostree("OSTree is too old.")
###########################################