Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: scripts/slave/recipes/infra/build_conda_cipd_pkg.py

Issue 1511383003: Add recipe to build CIPD package with relocatable Conda environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: add mathplot lib, depends on Qt :( Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipes/infra/build_conda_cipd_pkg.py
diff --git a/scripts/slave/recipes/infra/build_conda_cipd_pkg.py b/scripts/slave/recipes/infra/build_conda_cipd_pkg.py
new file mode 100644
index 0000000000000000000000000000000000000000..992fe6d9cc334aceb5b981f85456f99b8ffc0764
--- /dev/null
+++ b/scripts/slave/recipes/infra/build_conda_cipd_pkg.py
@@ -0,0 +1,75 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+DEPS = [
+ 'cipd',
+ 'conda',
+ 'file',
+ 'recipe_engine/path',
+ 'recipe_engine/platform',
+ 'recipe_engine/time',
+]
+
+
+# See https://repo.continuum.io/miniconda/. Miniconda3 is not supported.
+CONDA_VERSION = 'Miniconda2-3.18.3'
+
+
+# These conda packages will be installed into Conda environment.
+EXTRA_CONDA_PACKAGES = [
+ 'matplotlib',
+ 'numpy',
+ 'scipy',
+]
+
+
+def RunSteps(api):
+ # Prepare staging directory to install conda into.
+ staging_dir = api.path['slave_build'].join('conda_staging_dir')
+ api.file.rmtree('cleaning staging dir', staging_dir)
+
+ # Install miniconda and all Conda packages.
+ conda = api.conda.install(CONDA_VERSION, staging_dir)
+ for pkg in EXTRA_CONDA_PACKAGES:
+ conda.install(pkg)
+
+ # Wrap finished conda environment into CIPD package.
+ cipd_pkg_name = 'infra/conda_python/' + api.cipd.platform_suffix()
+ cipd_pkg_file = api.path['slave_build'].join('conda_python.cipd')
+ api.cipd.install_client()
+ conda.convert_to_cipd_package(cipd_pkg_name, cipd_pkg_file)
+
+ # Upload the CIPD package to the server.
+ #
+ # Conda installs unpinned packages at HEAD, and in general the resulting
+ # environment is not reproducible. Tag it with current time, to know when it
+ # was built.
+ if api.platform.is_win:
+ creds = 'C:\\creds\\service_accounts\\service-account-cipd-builder.json'
+ else:
+ creds = '/creds/service_accounts/service-account-cipd-builder.json'
+ api.cipd.set_service_account_credentials(creds)
+ api.cipd.register(
+ package_name=cipd_pkg_name,
+ package_path=cipd_pkg_file,
+ refs=['latest'],
+ tags={
+ 'conda': CONDA_VERSION.replace('.', '-'),
+ 'ts': api.time.utcnow().strftime('%Y-%m-%dT%H-%M'),
+ })
+
+
+def GenTests(api):
+ yield (
+ api.test('linux') +
+ api.platform.name('linux')
+ )
+ yield (
+ api.test('mac') +
+ api.platform.name('mac')
+ )
+ yield (
+ api.test('win') +
+ api.platform.name('win')
+ )

Powered by Google App Engine
This is Rietveld 408576698