diff options
-rwxr-xr-x | ghwt.py | 5 | ||||
-rwxr-xr-x | manual tests/4 standalone binaries/build_windows_package.py | 2 | ||||
-rw-r--r-- | mesonbuild/environment.py | 6 | ||||
-rw-r--r-- | mesonbuild/modules/windows.py | 6 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 7 |
5 files changed, 17 insertions, 9 deletions
@@ -22,10 +22,11 @@ import urllib.request, json, sys, os, shutil, subprocess import configparser, hashlib +req_timeout = 600.0 private_repos = {'meson', 'wrapweb', 'meson-ci'} def gh_get(url): - r = urllib.request.urlopen(url) + r = urllib.request.urlopen(url, timeout=req_timeout) jd = json.loads(r.read().decode('utf-8')) return jd @@ -45,7 +46,7 @@ def unpack(sproj, branch, outdir): config = configparser.ConfigParser() config.read(usfile) us_url = config['wrap-file']['source_url'] - us = urllib.request.urlopen(us_url).read() + us = urllib.request.urlopen(us_url, timeout=req_timeout).read() h = hashlib.sha256() h.update(us) dig = h.hexdigest() diff --git a/manual tests/4 standalone binaries/build_windows_package.py b/manual tests/4 standalone binaries/build_windows_package.py index b30ec4d..0932eac 100755 --- a/manual tests/4 standalone binaries/build_windows_package.py +++ b/manual tests/4 standalone binaries/build_windows_package.py @@ -11,7 +11,7 @@ shutil.rmtree('build', ignore_errors=True) os.mkdir('build') if not os.path.exists(sdl_filename): - response = urllib.request.urlopen(sdl_url) + response = urllib.request.urlopen(sdl_url, timeout=600.0) data = response.read() open(sdl_filename, 'wb').write(data) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index c64fe59..a5586dd 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -813,6 +813,12 @@ This is probably wrong, it should always point to the native compiler.''' % evar # up to date language version at time (2016). if 'DC' in os.environ: exelist = shlex.split(os.environ['DC']) + for dc in exelist[:]: + if os.path.basename(dc).startswith(('ldmd', 'gdmd')): + mlog.log('Meson doesn\'t support', mlog.bold(dc), 'as it\'s only a DMD frontend for another compiler, skipping.') + exelist.remove(dc) + if not exelist: + raise EnvironmentException('Couldn\'t find any compatible D compiler in the DC environment variable. Please provide a valid value for DC or unset it so that Meson resolve the compiler by itself.') elif self.is_cross_build() and want_cross: exelist = mesonlib.stringlistify(self.cross_info.config['binaries']['d']) is_cross = True diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index 24bd750..87209d6 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -90,16 +90,16 @@ class WindowsModule(ExtensionModule): if isinstance(src, str): name_format = 'file {!r}' - name = format(os.path.join(state.subdir, src)) + name = os.path.join(state.subdir, src) elif isinstance(src, mesonlib.File): name_format = 'file {!r}' - name = format(src.relative_name()) + name = src.relative_name() elif isinstance(src, build.CustomTarget): if len(src.get_outputs()) > 1: raise MesonException('windows.compile_resources does not accept custom targets with more than 1 output.') name_format = 'target {!r}' - name = format(src.get_id()) + name = src.get_id() else: raise MesonException('Unexpected source type {!r}. windows.compile_resources accepts only strings, files, custom targets, and lists thereof.'.format(src)) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index a3f8ab1..412097c 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -29,6 +29,7 @@ except ImportError: has_ssl = False API_ROOT = 'http://wrapdb.mesonbuild.com/v1/' +req_timeout = 600.0 ssl_warning_printed = False def build_ssl_context(): @@ -51,7 +52,7 @@ def open_wrapdburl(urlstring): global ssl_warning_printed if has_ssl: try: - return urllib.request.urlopen(urlstring)# , context=build_ssl_context()) + return urllib.request.urlopen(urlstring, timeout=req_timeout)# , context=build_ssl_context()) except urllib.error.URLError: if not ssl_warning_printed: print('SSL connection failed. Falling back to unencrypted connections.') @@ -64,7 +65,7 @@ def open_wrapdburl(urlstring): # certificate is not known. if urlstring.startswith('https'): urlstring = 'http' + urlstring[5:] - return urllib.request.urlopen(urlstring) + return urllib.request.urlopen(urlstring, timeout=req_timeout) class PackageDefinition: @@ -270,7 +271,7 @@ class Resolver: if url.startswith('https://wrapdb.mesonbuild.com'): resp = open_wrapdburl(url) else: - resp = urllib.request.urlopen(url) + resp = urllib.request.urlopen(url, timeout=req_timeout) with contextlib.closing(resp) as resp: try: dlsize = int(resp.info()['Content-Length']) |