Skip to content

Commit

Permalink
Merge pull request #3153 from msarahan/fix_private_channels
Browse files Browse the repository at this point in the history
fix private channels
  • Loading branch information
msarahan authored Sep 18, 2018
2 parents aa3e886 + bc2c676 commit 48ae347
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def detect_and_record_prefix_files(m, files, prefix):


def sanitize_channel(channel):
return re.sub('\/t\/[a-zA-Z0-9\-]*\/', '/t/<TOKEN>/', channel)
return re.sub(r'\/t\/[a-zA-Z0-9\-]*\/', '/t/<TOKEN>/', channel)


def write_info_files_file(m, files):
Expand Down Expand Up @@ -1263,7 +1263,7 @@ def build(m, stats, post=None, need_source_download=True, need_reparse_in_env=Fa
output_excludes = set(name for (name, variant) in m.other_outputs.keys())

if excludes or output_excludes:
exclude_pattern = re.compile('|'.join('(?:^{}(?:\s|$|\Z))'.format(exc)
exclude_pattern = re.compile(r'|'.join(r'(?:^{}(?:\s|$|\Z))'.format(exc)
for exc in excludes | output_excludes))

# this metadata object may not be finalized - the outputs are, but this is the
Expand Down
2 changes: 1 addition & 1 deletion conda_build/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def update_lib_path(path, target_platform, temp_dir=None):

elif target_platform == 'unix':
python_version = retrieve_python_version(temp_dir)
renamed_lib_path = re.sub('\ALib', os.path.join('lib', python_version), path)
renamed_lib_path = re.sub('\ALib', os.path.join('lib', python_version), path.replace('\\', '\\\\'))

return os.path.normpath(renamed_lib_path)

Expand Down
5 changes: 3 additions & 2 deletions conda_build/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def submit(self, fn, *args, **kwargs):
"noarch",
)

os.environ['CONDA_ADD_ANACONDA_TOKEN'] = "false"
# TODO: this is to make sure that the index doesn't leak tokens. It breaks use of private channels, though.
# os.environ['CONDA_ADD_ANACONDA_TOKEN'] = "false"


try:
Expand Down Expand Up @@ -502,7 +503,7 @@ def _add_namespace_to_spec(fn, info, dep_str, namemap, missing_dependencies, sub
return dep_str

spec = MatchSpec(dep_str)
if spec.namespace:
if hasattr(spec, 'namespace') and spec.namespace:
# this spec is fine
return dep_str
else:
Expand Down
8 changes: 4 additions & 4 deletions conda_build/os_utils/pyldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ def inspect_linkages_otool(filename, arch='native'):
args.extend(['-arch', os.uname()[4]])
args.extend(['-L', filename])
result = check_output(args).decode(encoding='ascii')
groups = re.findall('^\t(.*) \(compatibility', result, re.MULTILINE)
groups = re.findall(r'^\t(.*) \(compatibility', result, re.MULTILINE)
return groups


Expand All @@ -1115,7 +1115,7 @@ def inspect_linkages_ldd(filename):
result, err = process.communicate()
result = result.decode(encoding='ascii')
err = err.decode(encoding='ascii')
groups = re.findall('^\t(?!linux-gate\.so\.1.*$)[^ ]+ => (.*) \([0-9a-fx]+\)',
groups = re.findall(r'^\t(?!linux-gate\.so\.1.*$)[^ ]+ => (.*) \([0-9a-fx]+\)',
result, re.MULTILINE)
return groups

Expand Down Expand Up @@ -1171,9 +1171,9 @@ def ldd(*args):

def main(argv):
for idx, progname in enumerate(argv[0:2][::-1]):
if re.match('.*ldd(?:$|\.exe|\.py)', progname):
if re.match(r'.*ldd(?:$|\.exe|\.py)', progname):
return ldd(*argv[2 - idx:])
elif re.match('.*otool(?:$|\.exe|\.py)', progname):
elif re.match(r'.*otool(?:$|\.exe|\.py)', progname):
return otool(*argv[2 - idx:])
elif os.path.isfile(progname):
klass = codefile_class(progname)
Expand Down
4 changes: 2 additions & 2 deletions conda_build/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def finalize_metadata(m, permit_unsatisfiable_variants=False):
output_excludes = set(name for (name, variant) in m.other_outputs.keys())

if excludes or output_excludes:
exclude_pattern = re.compile('|'.join('(?:^{}(?:\s|$|\Z))'.format(exc)
exclude_pattern = re.compile(r'|'.join(r'(?:^{}(?:\s|$|\Z))'.format(exc)
for exc in excludes | output_excludes))

parent_recipe = m.meta.get('extra', {}).get('parent_recipe', {})
Expand Down Expand Up @@ -484,7 +484,7 @@ def finalize_metadata(m, permit_unsatisfiable_variants=False):
# on the keys in the 'pin_run_as_build' key in the variant, which is a list of package
# names to have this behavior.
if output_excludes:
exclude_pattern = re.compile('|'.join('(?:^{}(?:\s|$|\Z))'.format(exc)
exclude_pattern = re.compile(r'|'.join(r'(?:^{}(?:\s|$|\Z))'.format(exc)
for exc in output_excludes))
pinning_env = 'host' if rendered_metadata.is_cross else 'build'

Expand Down
14 changes: 7 additions & 7 deletions conda_build/skeletons/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def skeletonize(packages, output_dir=".", version=None, recursive=False,
# Fix the indents
recipe_lines = []
for line in rendered_recipe.splitlines():
match = re.search('^\s+(-) ', line,
match = re.search(r'^\s+(-) ', line,
flags=re.MULTILINE)
if match:
pre, sep, post = line.partition('-')
Expand Down Expand Up @@ -639,11 +639,11 @@ def convert_version(version):


MARKER_RE = re.compile(r"(?P<name>^[^=<>!\s]+)"
"\s*"
"(?P<constraint>[=!><]=?\s*[^\s;]+)?"
"(?:\s+;\s+)?(?P<env_mark_name>[^=<>!\s;]+)?"
"\s*"
"(?P<env_mark_constraint>[=<>!\s]+[^=<>!\s]+)?"
r"\s*"
r"(?P<constraint>[=!><]=?\s*[^\s;]+)?"
r"(?:\s+;\s+)?(?P<env_mark_name>[^=<>!\s;]+)?"
r"\s*"
r"(?P<env_mark_constraint>[=<>!\s]+[^=<>!\s]+)?"
)


Expand Down Expand Up @@ -857,7 +857,7 @@ def get_package_metadata(package, d, data, output_dir, python_version, all_extra
else:
license_name = ' or '.join(licenses)
# remove the word license from the license
clean_license_name = re.subn('(.*)\s+license', r'\1', license_name, flags=re.IGNORECASE)[0]
clean_license_name = re.subn(r'(.*)\s+license', r'\1', license_name, flags=re.IGNORECASE)[0]
d['license'] = clean_license_name
d['license_family'] = guess_license_family(license_name, allowed_license_families)
if 'new_hash_value' in pkginfo:
Expand Down
4 changes: 2 additions & 2 deletions conda_build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,14 @@ def _guess_patch_strip_level(filesstr, src_dir):


def _get_patch_file_details(path):
re_files = re.compile('^(?:---|\+\+\+) ([^\n\t]+)')
re_files = re.compile(r'^(?:---|\+\+\+) ([^\n\t]+)')
files = set()
with io.open(path, errors='ignore') as f:
files = []
first_line = True
is_git_format = True
for l in f.readlines():
if first_line and not re.match('From [0-9a-f]{40}', l):
if first_line and not re.match(r'From [0-9a-f]{40}', l):
is_git_format = False
first_line = False
m = re_files.search(l)
Expand Down
2 changes: 1 addition & 1 deletion tests/test-recipes/metadata/_numpy_xx/run_test.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo on
conda list -p "%PREFIX%" --canonical
if errorlevel 1 exit 1
conda list -p "%PREFIX%" --canonical | grep "conda-build-test-numpy-build-run-1\.0-np112py.._0"
conda list -p "%PREFIX%" --canonical | grep "conda-build-test-numpy-build-run-1\.0-np115py.._0"
if errorlevel 1 exit 1
4 changes: 2 additions & 2 deletions tests/test-recipes/metadata/_numpy_xx/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def main():
prefix = os.environ['PREFIX']

info_files = glob.glob(os.path.join(prefix, 'conda-meta',
'conda-build-test-numpy-build-run-1.0-np112py*0.json'))
'conda-build-test-numpy-build-run-1.0-np115py*0.json'))
assert len(info_files) == 1
info_file = info_files[0]
with open(info_file, 'r') as fh:
Expand All @@ -21,7 +21,7 @@ def main():
assert depends[1].startswith('python ')

import numpy
assert numpy.__version__[:4] == '1.12'
assert numpy.__version__[:4] == '1.15'


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/test-recipes/metadata/_numpy_xx/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
conda list -p $PREFIX --canonical
# Test the build string. Should contain NumPy, but not the version
conda list -p $PREFIX --canonical | grep "conda-build-test-numpy-build-run-1\.0-np112py.._0"
conda list -p $PREFIX --canonical | grep "conda-build-test-numpy-build-run-1\.0-np115py.._0"
2 changes: 1 addition & 1 deletion tests/test-recipes/metadata/_numpy_xx_host/run_test.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo on
conda list -p "%PREFIX%" --canonical
if errorlevel 1 exit 1
conda list -p "%PREFIX%" --canonical | grep "conda-build-test-numpy-build-run-1\.0-np112py.._0"
conda list -p "%PREFIX%" --canonical | grep "conda-build-test-numpy-build-run-1\.0-np115py.._0"
if errorlevel 1 exit 1
4 changes: 2 additions & 2 deletions tests/test-recipes/metadata/_numpy_xx_host/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def main():
prefix = os.environ['PREFIX']

info_files = glob.glob(os.path.join(prefix, 'conda-meta',
'conda-build-test-numpy-build-run-1.0-np112py*0.json'))
'conda-build-test-numpy-build-run-1.0-np115py*0.json'))
assert len(info_files) == 1
info_file = info_files[0]
with open(info_file, 'r') as fh:
Expand All @@ -21,7 +21,7 @@ def main():
assert depends[1].startswith('python ')

import numpy
assert numpy.__version__[:4] == '1.12'
assert numpy.__version__[:4] == '1.15'


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/test-recipes/metadata/_numpy_xx_host/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
conda list -p $PREFIX --canonical
# Test the build string. Should contain NumPy, but not the version
conda list -p $PREFIX --canonical | grep "conda-build-test-numpy-build-run-1\.0-np112py.._0"
conda list -p $PREFIX --canonical | grep "conda-build-test-numpy-build-run-1\.0-np115py.._0"
4 changes: 2 additions & 2 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,12 @@ def test_setup_py_data_in_env(testing_config):

def test_numpy_xx(testing_config):
recipe = os.path.join(metadata_dir, '_numpy_xx')
api.build(recipe, config=testing_config, numpy='1.12')
api.build(recipe, config=testing_config, numpy='1.15', python="3.6")


def test_numpy_xx_host(testing_config):
recipe = os.path.join(metadata_dir, '_numpy_xx_host')
api.build(recipe, config=testing_config, numpy='1.12')
api.build(recipe, config=testing_config, numpy='1.15', python="3.6")


def test_python_xx(testing_config):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_api_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_pypi_with_version_arg(testing_workdir):

def test_pypi_with_extra_specs(testing_workdir):
# regression test for https://github.com/conda/conda-build/issues/1697
api.skeletonize('bigfile', 'pypi', extra_specs=["cython", "mpi4py"], version='0.1.24')
api.skeletonize('bigfile', 'pypi', extra_specs=["cython", "mpi4py"], version='0.1.24', python="3.6")
m = api.render('bigfile')[0][0]
assert parse_version(m.version()) == parse_version("0.1.24")
assert any('cython' in req for req in m.meta['requirements']['host'])
Expand All @@ -119,7 +119,7 @@ def test_pypi_with_extra_specs(testing_workdir):

def test_pypi_with_version_inconsistency(testing_workdir):
# regression test for https://github.com/conda/conda-build/issues/189
api.skeletonize('mpi4py_test', 'pypi', extra_specs=["mpi4py"], version='0.0.10')
api.skeletonize('mpi4py_test', 'pypi', extra_specs=["mpi4py"], version='0.0.10', python="3.6")
m = api.render('mpi4py_test')[0][0]
assert parse_version(m.version()) == parse_version("0.0.10")

Expand Down

0 comments on commit 48ae347

Please sign in to comment.