summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cerbero/bootstrap/build_tools.py8
-rw-r--r--cerbero/utils/__init__.py8
-rw-r--r--cerbero/utils/shell.py5
-rw-r--r--recipes/build-tools/meson.recipe18
4 files changed, 29 insertions, 10 deletions
diff --git a/cerbero/bootstrap/build_tools.py b/cerbero/bootstrap/build_tools.py
index f9659be5..b2b98a56 100644
--- a/cerbero/bootstrap/build_tools.py
+++ b/cerbero/bootstrap/build_tools.py
@@ -123,9 +123,15 @@ class BuildTools (BootstrapperBase, Fetch):
os.remove(tof)
shutil.move(os.path.join(scriptsdir, f), tof)
os.rmdir(scriptsdir)
+ python = os.path.join(self.config.build_tools_prefix, 'bin', 'python')
+ shell.new_call([python, '-m', 'pip', 'install', 'setuptools'])
async def start(self, jobs=0):
- self.setup_venv()
+ python = os.path.join(self.config.build_tools_prefix, 'bin', 'python')
+ if self.config.platform == Platform.WINDOWS:
+ python += '.exe'
+ if not os.path.exists(python):
+ self.setup_venv()
# Check and these at the last minute because we may have installed them
# in system bootstrap
self.recipes += self.check_build_tools()
diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py
index 624a461e..4f08d6a1 100644
--- a/cerbero/utils/__init__.py
+++ b/cerbero/utils/__init__.py
@@ -33,7 +33,6 @@ try:
import xml.etree.cElementTree as etree
except ImportError:
from lxml import etree
-from distutils.version import StrictVersion
import gettext
import platform as pplatform
import re
@@ -544,6 +543,9 @@ def add_system_libs(config, new_env, old_env=None):
os.path.join(sysroot, 'usr/share/aclocal')]
new_env['ACLOCAL_PATH'] = ':'.join(search_paths)
+def split_version(s):
+ return tuple(int(e) for e in s.split('.'))
+
def needs_xcode8_sdk_workaround(config):
'''
Returns whether the XCode 8 clock_gettime, mkostemp, getentropy workaround
@@ -552,10 +554,10 @@ def needs_xcode8_sdk_workaround(config):
These symbols are only available on macOS 10.12+ and iOS 10.0+
'''
if config.target_platform == Platform.DARWIN:
- if StrictVersion(config.min_osx_sdk_version) < StrictVersion('10.12'):
+ if split_version(config.min_osx_sdk_version) < (10, 12):
return True
elif config.target_platform == Platform.IOS:
- if StrictVersion(config.ios_min_version) < StrictVersion('10.0'):
+ if split_version(config.ios_min_version) < (10, 0):
return True
return False
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index a47347cf..60f07393 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -33,10 +33,9 @@ import hashlib
import urllib.request, urllib.error, urllib.parse
import collections
from pathlib import Path, PurePath
-from distutils.version import StrictVersion
from cerbero.enums import CERBERO_VERSION, Platform, Distro
-from cerbero.utils import _, system_info, to_unixpath, determine_num_of_cpus, CerberoSemaphore
+from cerbero.utils import _, system_info, split_version, CerberoSemaphore
from cerbero.utils import messages as m
from cerbero.errors import CommandError, FatalError
@@ -682,7 +681,7 @@ def check_tool_version(tool_name, needed, env, version_arg=None):
m = re.search(r'([0-9]+\.[0-9]+(\.[0-9]+)?)', out)
if m:
found = m.groups()[0]
- newer = StrictVersion(found) >= StrictVersion(needed)
+ newer = split_version(found) >= split_version(needed)
return tool, found, newer
diff --git a/recipes/build-tools/meson.recipe b/recipes/build-tools/meson.recipe
index dafb5c6b..794dfe76 100644
--- a/recipes/build-tools/meson.recipe
+++ b/recipes/build-tools/meson.recipe
@@ -1,7 +1,8 @@
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
+import glob
import shutil
-from pathlib import PurePath, Path
+from pathlib import PurePath
class Recipe(recipe.Recipe):
name = 'meson'
@@ -31,6 +32,17 @@ class Recipe(recipe.Recipe):
# Our workaround is to only install the script into bin. This also
# fixes things on Windows, where the script is installed into Scripts/
# instead of bin/
- await shell.async_call([self.config.python_exe, 'setup.py', 'install',
- '--prefix', prefix, '--install-scripts', '{}/bin'.format(prefix)],
+ await shell.async_call([self.config.python_exe, '-m', 'pip', 'install', '--prefix', prefix, '.'],
cmd_dir=self.build_dir, env=self.env, logfile=self.logfile)
+ if self.config.platform == Platform.WINDOWS:
+ # Python insists on using Scripts instead of bin on Windows for
+ # scripts. Insist back, and use bin again.
+ scriptsdir = os.path.join(prefix, 'Scripts')
+ bindir = os.path.join(prefix, 'bin')
+ os.makedirs(bindir, exist_ok=True)
+ for f in glob.glob('*', root_dir=scriptsdir):
+ tof = os.path.join(bindir, f)
+ if os.path.isfile(tof):
+ os.remove(tof)
+ shutil.move(os.path.join(scriptsdir, f), tof)
+ os.rmdir(scriptsdir)