Commit e8beece4 authored by Tristan Maat's avatar Tristan Maat

setup.py: Make setup.py work on non-linux

parent 4f814b1e
Pipeline #12275785 failed with stages
in 60 minutes and 9 seconds
......@@ -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 .
......
......@@ -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.")
###########################################
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment