Last active
February 18, 2022 23:19
-
-
Save xylar/e02438b5a19e8aa73439ef2bc42b9aea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess | |
import os | |
subdir = 'linux-64' | |
specs = ['python=3.9', | |
#'qt=5.12.9',', | |
'dbus >=1.13.6,<2.0a0', | |
'expat >=2.2.10,<3.0.0a0', | |
'fontconfig >=2.13.1,<3.0a0', | |
'freetype >=2.10.4,<3.0a0', | |
'gst-plugins-base >=1.18.3,<1.19.0a0', | |
'gstreamer >=1.18.3,<1.19.0a0', | |
'icu >=68.1,<69.0a0', | |
'jpeg >=9d,<10a', | |
'libclang >=11.0.1,<12.0a0', | |
'libevent >=2.1.10,<2.1.11.0a0', | |
'libgcc-ng >=9.3.0', | |
'libglib >=2.66.7,<3.0a0', | |
'libpng >=1.6.37,<1.7.0a0', | |
'libpq >=13.1,<14.0a0', | |
'libstdcxx-ng >=9.3.0', | |
'libxcb', | |
'libxkbcommon >=1.0.3,<2.0a0', | |
'libxml2 >=2.9.10,<2.10.0a0', | |
'mysql-libs >=8.0.23,<8.1.0.0a0', | |
'nspr >=4.29,<5.0a0', | |
'nss >=3.61,<4.0a0', | |
'openssl >=1.1.1j,<1.1.2a', | |
'sqlite >=3.34.0,<4.0a0', | |
'zlib >=1.2.11,<1.3.0a0', | |
#'libgdal=3.4.0', | |
'blosc >=1.21.0,<2.0a0', | |
#'expat >=2.4.1,<3.0a0', | |
'freexl >=1.0.6,<2.0a0', | |
'geos >=3.10.1,<3.10.2.0a0', | |
'geotiff >=1.7.0,<1.7.1.0a0', | |
'giflib >=5.2.1,<5.3.0a0', | |
'hdf4 >=4.2.15,<4.3.0a0', | |
'hdf5 >=1.12.1,<1.12.2.0a0', | |
'icu >=68.2,<69.0a0', | |
'jpeg >=9d,<10a', | |
'json-c >=0.15,<0.16.0a0', | |
'kealib >=1.4.14,<1.5.0a0', | |
'libdap4 >=3.20.6,<3.20.7.0a0', | |
'libgcc-ng >=9.4.0', | |
'libkml >=1.3.0,<1.4.0a0', | |
'libnetcdf >=4.8.1,<4.8.2.0a0', | |
'libpng >=1.6.37,<1.7.0a0', | |
#'libpq >=14.1,<15.0a0', | |
'libspatialite >=5.0.1,<5.1.0a0', | |
'libstdcxx-ng >=9.4.0', | |
'libtiff >=4.3.0,<5.0a0', | |
'libuuid >=2.32.1,<3.0a0', | |
'libwebp-base', | |
'libxml2 >=2.9.12,<2.10.0a0', | |
'libzlib >=1.2.11,<1.3.0a0', | |
'openjpeg >=2.4.0,<2.5.0a0', | |
'openssl >=1.1.1l,<1.1.2a', | |
'pcre >=8.45,<9.0a0', | |
'poppler >=21.11.0,<21.12.0a0', | |
'postgresql', | |
'proj >=8.2.0,<8.2.1.0a0', | |
'sqlite >=3.37.0,<4.0a0', | |
'tiledb >=2.5.2,<2.6.0a0', | |
'xerces-c >=3.2.3,<3.3.0a0', | |
'xz >=5.2.5,<5.3.0a0', | |
'zstd >=1.5.0,<1.6.0a0'] | |
base_command = ['mamba', 'create', '-y', '-n', 'test', '--dry-run'] | |
prevEnd = None | |
highestValid = -1 | |
lowestInvalid = len(specs) | |
endIndex = len(specs) | |
while highestValid != lowestInvalid-1: | |
subset_specs = specs[0:endIndex] | |
print('last: {}'.format(subset_specs[-1])) | |
command = base_command + subset_specs | |
try: | |
env = dict(os.environ) | |
env['CONDA_SUBDIR'] = subdir | |
subprocess.check_call(command, stdout=subprocess.DEVNULL, env=env) | |
highestValid = endIndex-1 | |
endIndex = int(0.5 + 0.5*(highestValid + lowestInvalid)) + 1 | |
print(' Succeeded!') | |
except subprocess.CalledProcessError: | |
lowestInvalid = endIndex-1 | |
endIndex = int(0.5 + 0.5*(highestValid + lowestInvalid)) + 1 | |
print(' Failed!') | |
print(' valid: {}, invalid: {}, end: {}'.format( | |
highestValid, lowestInvalid, endIndex)) | |
if lowestInvalid == len(specs): | |
print('No failures!') | |
else: | |
print('First failing package: {}'.format(specs[lowestInvalid])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment