| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 DEPS = [ |
| 6 'cipd', |
| 7 'conda', |
| 8 'file', |
| 9 'recipe_engine/path', |
| 10 'recipe_engine/platform', |
| 11 'recipe_engine/time', |
| 12 ] |
| 13 |
| 14 |
| 15 # See https://repo.continuum.io/miniconda/. Miniconda3 is not supported. |
| 16 CONDA_VERSION = 'Miniconda2-3.18.3' |
| 17 |
| 18 |
| 19 # These conda packages will be installed into Conda environment. |
| 20 EXTRA_CONDA_PACKAGES = [ |
| 21 'matplotlib', |
| 22 'numpy', |
| 23 'scipy', |
| 24 ] |
| 25 |
| 26 |
| 27 def RunSteps(api): |
| 28 # Prepare staging directory to install conda into. |
| 29 staging_dir = api.path['slave_build'].join('conda_staging_dir') |
| 30 api.file.rmtree('cleaning staging dir', staging_dir) |
| 31 |
| 32 # Install miniconda and all Conda packages. |
| 33 conda = api.conda.install(CONDA_VERSION, staging_dir) |
| 34 for pkg in EXTRA_CONDA_PACKAGES: |
| 35 conda.install(pkg) |
| 36 |
| 37 # Wrap finished conda environment into CIPD package. |
| 38 cipd_pkg_name = 'infra/conda_python/' + api.cipd.platform_suffix() |
| 39 cipd_pkg_file = api.path['slave_build'].join('conda_python.cipd') |
| 40 api.cipd.install_client() |
| 41 conda.convert_to_cipd_package(cipd_pkg_name, cipd_pkg_file) |
| 42 |
| 43 # Upload the CIPD package to the server. |
| 44 # |
| 45 # Conda installs unpinned packages at HEAD, and in general the resulting |
| 46 # environment is not reproducible. Tag it with current time, to know when it |
| 47 # was built. |
| 48 if api.platform.is_win: |
| 49 creds = 'C:\\creds\\service_accounts\\service-account-cipd-builder.json' |
| 50 else: |
| 51 creds = '/creds/service_accounts/service-account-cipd-builder.json' |
| 52 api.cipd.set_service_account_credentials(creds) |
| 53 api.cipd.register( |
| 54 package_name=cipd_pkg_name, |
| 55 package_path=cipd_pkg_file, |
| 56 refs=['latest'], |
| 57 tags={ |
| 58 'conda': CONDA_VERSION.replace('.', '-'), |
| 59 'ts': api.time.utcnow().strftime('%Y-%m-%dT%H-%M'), |
| 60 }) |
| 61 |
| 62 |
| 63 def GenTests(api): |
| 64 yield ( |
| 65 api.test('linux') + |
| 66 api.platform.name('linux') |
| 67 ) |
| 68 yield ( |
| 69 api.test('mac') + |
| 70 api.platform.name('mac') |
| 71 ) |
| 72 yield ( |
| 73 api.test('win') + |
| 74 api.platform.name('win') |
| 75 ) |
| OLD | NEW |