From efe21a47c64b2030798128b02fc8730fbb78f4c2 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Mon, 16 Sep 2024 07:37:27 -0500 Subject: [PATCH 1/4] start constructor example --- examples/constructor/.gitignore | 1 + examples/constructor/LICENSE | 28 +++++++++++++ examples/constructor/README.md | 21 ++++++++++ examples/constructor/construct.yaml | 18 +++++++++ examples/constructor/pixi.toml | 63 +++++++++++++++++++++++++++++ 5 files changed, 131 insertions(+) create mode 100644 examples/constructor/.gitignore create mode 100644 examples/constructor/LICENSE create mode 100644 examples/constructor/README.md create mode 100644 examples/constructor/construct.yaml create mode 100644 examples/constructor/pixi.toml diff --git a/examples/constructor/.gitignore b/examples/constructor/.gitignore new file mode 100644 index 000000000..bd76a3d35 --- /dev/null +++ b/examples/constructor/.gitignore @@ -0,0 +1 @@ +explicit_specs/ diff --git a/examples/constructor/LICENSE b/examples/constructor/LICENSE new file mode 100644 index 000000000..4b653c086 --- /dev/null +++ b/examples/constructor/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2023, prefix.dev GmbH + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/constructor/README.md b/examples/constructor/README.md new file mode 100644 index 000000000..ad1e236ec --- /dev/null +++ b/examples/constructor/README.md @@ -0,0 +1,21 @@ +# Constructor Example + +This demo shows how to use `pixi` to generate explicit `conda` environment specs, +and [`constructor`][constructor] to transform specs into platform-specific, +offline-ready installers. + +## How to use? + +Make sure you have `pixi` available in your terminal. + +Navigate to this directory and run: + +```shell +# Build the installer +pixi run build + +# Install the built installer +pixi run start +``` + +[constructor]: https://conda.github.io/constructor diff --git a/examples/constructor/construct.yaml b/examples/constructor/construct.yaml new file mode 100644 index 000000000..4f5f54ec3 --- /dev/null +++ b/examples/constructor/construct.yaml @@ -0,0 +1,18 @@ +# see https://github.com/conda/constructor/blob/main/CONSTRUCT.md +name: MyInstaller +version: 0.0.1 +company: My Company +license_file: LICENSE + +channels: + - conda-forge + +environment_file: "./specs/installer_{{ os.environ.CC_PLATFORM }}.conda_spec.txt" + +write_condarc: True +initialize_conda: True +initialize_by_default: False + +virtual_specs: + - __glibc >=2.17 # [linux] + - __osx >=10.13 # [osx] diff --git a/examples/constructor/pixi.toml b/examples/constructor/pixi.toml new file mode 100644 index 000000000..314f32e92 --- /dev/null +++ b/examples/constructor/pixi.toml @@ -0,0 +1,63 @@ +[project] +name = "constructor" +channels = ["conda-forge"] +platforms = ["linux-64", "linux-aarch64", "linux-ppc64le", "osx-64", "osx-arm64", "win-64"] + +[environments] +installer = ["installer"] +build = ["build", "build-linux", "build-osx", "build-win"] + +[feature.installer.dependencies] +python = "*" + +[feature.build.dependencies] +constructor = ">=3.9.2" +jaq = "*" + +[feature.build.tasks] +specs = "pixi project export conda_explicit_spec --environment installer ./specs" +construct = """ +rm -rf dist/installer/$CC_PLATFORM +&& constructor . --cache-dir build/.cache/constructor --output-dir dist/installer/$CC_PLATFORM +""" +platform = "pixi info --json | jaq -r '.platform'" + +[feature.build-linux] +platforms = ["linux-64", "linux-aarch64", "linux-ppcle64"] +[feature.build-linux.tasks] +build = {depends-on = ["specs", "build-linux-64", "build-linux-aarch64", "build-linux-ppcle64"]} +build-linux-64 = "CC_PLATFORM=linux-64 pixi run construct" +build-linux-aarch64 = "CC_PLATFORM=linux-aarch64 pixi run construct" +build-linxu-ppcle64 = "CC_PLATFORM=linux-ppcle64 pixi run construct" +start = {depends-on = ["build"], cmd = """ +rm -rf build/_installer_env_/ +&& bash dist/installer/$(pixi run platform)/*.sh -fbp build/_installer_env_/ +"""} + +[feature.build-osx] +platforms = ["osx-64", "osx-arm64"] +[feature.build-osx.tasks] +build = {depends-on = ["specs", "build-osx-64", "build-osx-arm64"]} +build-osx-64 = "CC_PLATFORM=osx-64 pixi run construct" +build-osx-arm64 = "CC_PLATFORM=osx-arm64 pixi run construct" +start = {depends-on = ["build"], cmd = """ +rm -rf build/_installer_env_/ +&& bash dist/installer/$(pixi run platform)/*.sh -fbp build/_installer_env_/ +"""} + +[feature.build-win] +platforms = ["win-64"] +[feature.build-win.tasks] +build = {depends-on = ["specs", "build-win-64"]} +build-win-64 = "CC_PLATFORM=win-64 pixi run construct" +start = {depends-on = ["build"], cmd = ''' +rm -rf build/_installer_env_/ +&& start + /wait + "" + \dist\installer\$(pixi run platform)\*.exe + /InstallationType=JustMe + /RegisterPython=0 + /S + /D=build\_installer_env_\ +'''} From ebaca5dfa22efd5e7a0f832df53c80b88995a96d Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Fri, 20 Sep 2024 09:06:55 -0500 Subject: [PATCH 2/4] rework constructor as minimal --- .../.gitignore | 0 .../LICENSE | 0 examples/constructor-minimal/README.md | 21 ++++ .../installer/construct.yaml | 8 +- .../pixi.lock | 82 +++++++++++++++- examples/constructor-minimal/pixi.toml | 84 ++++++++++++++++ examples/constructor/README.md | 44 --------- examples/constructor/pixi.toml | 98 ------------------- 8 files changed, 188 insertions(+), 149 deletions(-) rename examples/{constructor => constructor-minimal}/.gitignore (100%) rename examples/{constructor => constructor-minimal}/LICENSE (100%) create mode 100644 examples/constructor-minimal/README.md rename examples/{constructor => constructor-minimal}/installer/construct.yaml (59%) rename examples/{constructor => constructor-minimal}/pixi.lock (98%) create mode 100644 examples/constructor-minimal/pixi.toml delete mode 100644 examples/constructor/README.md delete mode 100644 examples/constructor/pixi.toml diff --git a/examples/constructor/.gitignore b/examples/constructor-minimal/.gitignore similarity index 100% rename from examples/constructor/.gitignore rename to examples/constructor-minimal/.gitignore diff --git a/examples/constructor/LICENSE b/examples/constructor-minimal/LICENSE similarity index 100% rename from examples/constructor/LICENSE rename to examples/constructor-minimal/LICENSE diff --git a/examples/constructor-minimal/README.md b/examples/constructor-minimal/README.md new file mode 100644 index 000000000..9492ed8e5 --- /dev/null +++ b/examples/constructor-minimal/README.md @@ -0,0 +1,21 @@ +# Constructor Minimal Example + +This demo shows how to use `pixi` to generate explicit `conda` environment specs, +and [`constructor`][constructor] to use these specs to build platform-specific, +offline-ready installers. + +## How to use? + +Make sure you have `pixi` available in your terminal. + +Navigate to this directory and run: + +```shell +# Build the installer +pixi run build + +# Install the built installer +pixi run start +``` + +[constructor]: https://conda.github.io/constructor diff --git a/examples/constructor/installer/construct.yaml b/examples/constructor-minimal/installer/construct.yaml similarity index 59% rename from examples/constructor/installer/construct.yaml rename to examples/constructor-minimal/installer/construct.yaml index f44ad39ea..518f42ffc 100644 --- a/examples/constructor/installer/construct.yaml +++ b/examples/constructor-minimal/installer/construct.yaml @@ -1,13 +1,15 @@ # see https://github.com/conda/constructor/blob/main/CONSTRUCT.md -name: {{ environ["PIXI_PROJECT_NAME"].title().replace(' ', '') }} -version: {{ environ["PIXI_PROJECT_VERSION"] }} +{% set spec = "./specs/installer_" ~ environ.CC_PLATFORM ~ "_conda_spec.txt" %} + +name: MySimpleInstaller +version: 0.1.0 company: My Company license_file: ../LICENSE channels: - conda-forge -environment_file: "./specs/installer_{{ os.environ.CC_PLATFORM }}_conda_spec.txt" +environment_file: "{{ spec }}" write_condarc: True initialize_conda: True diff --git a/examples/constructor/pixi.lock b/examples/constructor-minimal/pixi.lock similarity index 98% rename from examples/constructor/pixi.lock rename to examples/constructor-minimal/pixi.lock index 9b415687e..09774c3ff 100644 --- a/examples/constructor/pixi.lock +++ b/examples/constructor-minimal/pixi.lock @@ -63,9 +63,9 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-h4ab18f5_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/lz4-c-1.9.4-hcb278e6_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/lzo-2.10-hd590300_1001.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/mamba-1.5.9-py312h9460a1c_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/markupsafe-2.1.5-py312h66e93f0_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/menuinst-2.1.2-py312h7900ff3_1.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/micromamba-1.5.9-1.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.3.2-hb9d3cd8_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.1-pyhd8ed1ab_0.conda @@ -151,9 +151,9 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h68df207_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lz4-c-1.9.4-hd600fc2_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/lzo-2.10-h31becfc_1001.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/mamba-1.5.9-py312hd80a4d2_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/markupsafe-2.1.5-py312h52516f5_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/menuinst-2.1.2-py312h996f985_1.conda - - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/micromamba-1.5.9-1.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-hcccb83c_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.3.2-h86ecc28_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.1-pyhd8ed1ab_0.conda @@ -240,9 +240,9 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/libzlib-1.3.1-h1f2b957_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/lz4-c-1.9.4-h883269e_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/lzo-2.10-ha17a0cc_1001.conda + - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/mamba-1.5.9-py312hff23a77_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/markupsafe-2.1.5-py312he7221a8_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/menuinst-2.1.2-py312h7864ebf_1.conda - - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/micromamba-1.5.9-1.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/ncurses-6.5-hd444e8b_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-ppc64le/openssl-3.3.2-h190368a_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.1-pyhd8ed1ab_0.conda @@ -334,9 +334,9 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/m2w64-gcc-libs-core-5.3.0-7.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/win-64/m2w64-gmp-6.1.0-2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/win-64/m2w64-libwinpthread-git-5.0.0.4634.697f757-2.tar.bz2 + - conda: https://conda.anaconda.org/conda-forge/win-64/mamba-1.5.9-py312h5494d5c_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/markupsafe-2.1.5-py312h4389bb4_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/menuinst-2.1.2-py312h275cf98_1.conda - - conda: https://conda.anaconda.org/conda-forge/win-64/micromamba-1.5.9-1.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/win-64/msys2-conda-epoch-20160418-1.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/win-64/nsis-3.10-h2be35fd_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/openjpeg-2.5.2-h3d672ee_0.conda @@ -3798,6 +3798,80 @@ packages: license: MIT, BSD size: 31928 timestamp: 1608166099896 +- kind: conda + name: mamba + version: 1.5.9 + build: py312h5494d5c_0 + subdir: win-64 + url: https://conda.anaconda.org/conda-forge/win-64/mamba-1.5.9-py312h5494d5c_0.conda + sha256: 5510a307d1a21a692c990528b34107863e354b05661b9eb86cbf2b3214c1069f + md5: 1d335e6ccbb1cdf5d5418011f3435251 + depends: + - conda >=24,<25 + - libmambapy 1.5.9 py312h0723cf6_0 + - openssl >=3.3.1,<4.0a0 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + size: 89353 + timestamp: 1725068243349 +- kind: conda + name: mamba + version: 1.5.9 + build: py312h9460a1c_0 + subdir: linux-64 + url: https://conda.anaconda.org/conda-forge/linux-64/mamba-1.5.9-py312h9460a1c_0.conda + sha256: a628b976e878a3502db8306d710937d577297ee6d31a62f0aa8d29fa00efe91b + md5: a8525c8a1647b4f5967fa6b552722851 + depends: + - conda >=24,<25 + - libmambapy 1.5.9 py312h7fb9e8e_0 + - openssl >=3.3.1,<4.0a0 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + size: 64422 + timestamp: 1725067034169 +- kind: conda + name: mamba + version: 1.5.9 + build: py312hd80a4d2_0 + subdir: linux-aarch64 + url: https://conda.anaconda.org/conda-forge/linux-aarch64/mamba-1.5.9-py312hd80a4d2_0.conda + sha256: e75f93fea9a6bac34a5cbbff3e968248f4e69d71df915ffca395b01933266aba + md5: 6089cf39e91b88dcf703c637e18ab7bf + depends: + - conda >=24,<25 + - libmambapy 1.5.9 py312hc6280c9_0 + - openssl >=3.3.1,<4.0a0 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + size: 65437 + timestamp: 1725067583194 +- kind: conda + name: mamba + version: 1.5.9 + build: py312hff23a77_0 + subdir: linux-ppc64le + url: https://conda.anaconda.org/conda-forge/linux-ppc64le/mamba-1.5.9-py312hff23a77_0.conda + sha256: 2a15608d229ca46465f176a04f9f83cd4aa9cdb7616720c5653e999dc8f32059 + md5: 7030ea48a56213e623a8973727813338 + depends: + - conda >=24,<25 + - libmambapy 1.5.9 py312haf8c6e0_0 + - openssl >=3.3.1,<4.0a0 + - python >=3.12,<3.13.0a0 + - python >=3.12,<3.13.0a0 *_cpython + - python_abi 3.12.* *_cp312 + license: BSD-3-Clause + license_family: BSD + size: 65147 + timestamp: 1725067507255 - kind: conda name: markupsafe version: 2.1.5 diff --git a/examples/constructor-minimal/pixi.toml b/examples/constructor-minimal/pixi.toml new file mode 100644 index 000000000..47244433e --- /dev/null +++ b/examples/constructor-minimal/pixi.toml @@ -0,0 +1,84 @@ +[project] +channels = ["conda-forge"] +name = "my installer" +platforms = [ + "linux-64", + "linux-aarch64", + "linux-ppc64le", + "osx-64", + "osx-arm64", + "win-64", +] +version = "0.1.0" + +[environments] +build-linux = ["build", "build-linux"] +build-osx = ["build", "build-osx", "build-win"] +build-win = ["build", "build-win"] +installer = ["installer"] + +[feature.installer.dependencies] +micromamba = "*" # provide `bin/activate` (or `Scripts/activate`) +python = "*" # constructor requires this for `@EXPLICIT` envs + +[feature.build.dependencies] +constructor = "*" +jaq = "*" # needed to get current platform +mamba = "*" # needed for cross-architecturo solves + +[feature.build.tasks] +construct = """ + rm -rf dist/installer/$CC_PLATFORM + && constructor installer + --platform $CC_PLATFORM + --cache-dir build/.cache/constructor + --output-dir dist/installer/$CC_PLATFORM + --conda-exe $(which mamba || where mamba) +""" +platform = "pixi info --json | jaq -r '.platform'" +specs = "pixi project export conda-explicit-spec --environment installer ./installer/specs" + +[feature.build-linux] +platforms = ["linux-64", "linux-aarch64", "linux-ppc64le"] +[feature.build-linux.tasks] +build = { depends-on = [ + "specs", + "build-linux-64", + "build-linux-aarch64", + "build-linux-ppc64le", +] } +build-linux-64 = "CC_PLATFORM=linux-64 pixi run construct" +build-linux-aarch64 = "CC_PLATFORM=linux-aarch64 pixi run construct" +build-linux-ppc64le = "CC_PLATFORM=linux-ppc64le pixi run construct" +start = { depends-on = ["build"], cmd = """ + rm -rf build/_installer_env_/ + && bash dist/installer/$(pixi run platform)/*.sh -fbp build/_installer_env_/ +""" } + +[feature.build-osx] +platforms = ["osx-64", "osx-arm64"] +[feature.build-osx.tasks] +build = { depends-on = ["specs", "build-osx-64", "build-osx-arm64"] } +build-osx-64 = "CC_PLATFORM=osx-64 pixi run construct" +build-osx-arm64 = "CC_PLATFORM=osx-arm64 pixi run construct" +start = { depends-on = ["build"], cmd = """ + rm -rf build/_installer_env_/ + && bash dist/installer/$(pixi run platform)/*.sh -fbp build/_installer_env_/ +""" } + +[feature.build-win] +platforms = ["win-64"] +[feature.build-win.tasks] +build = { depends-on = ["specs", "build-win-64"] } +build-win-64 = "CC_PLATFORM=win-64 pixi run construct" +start = { depends-on = ["build"], cmd = ''' +rm -rf build/_installer_env_/ +&& start + /wait + "" + dist\installer\$(pixi run platform)\*.exe + /InstallationType=JustMe + /RegisterPython=0 + /S + /D=build\_installer_env_ +''' } diff --git a/examples/constructor/README.md b/examples/constructor/README.md deleted file mode 100644 index a86303b07..000000000 --- a/examples/constructor/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Constructor Example - -This demo shows how to use `pixi` to generate explicit `conda` environment specs, -and [`constructor`][constructor] to use these specs to build platform-specific, -offline-ready installers. - -## How to use? - -Make sure you have `pixi` available in your terminal. - -Navigate to this directory and run: - -```shell -# Build the installer -pixi run build - -# Install the built installer -pixi run start -``` - -[constructor]: https://conda.github.io/constructor -[rattler-build]: https://prefix-dev.github.io/rattler-build - -## How does it work? - -```mermaid -flowchart BT - build --> installer --> start --> installation - build --> other-installer - construct-yaml & spec --> build - specs --> spec - - build([pixi r build]) - start([pixi r start]) - specs([pixi r specs]) - - installer[Installer-SomeOs64] - other-installer[Installer-SomeOsARM64] - - construct-yaml[construct.yaml] - spec[installer_my-os_conda_spec.txt] - - installation[[an installation]] -``` diff --git a/examples/constructor/pixi.toml b/examples/constructor/pixi.toml deleted file mode 100644 index 9feaec583..000000000 --- a/examples/constructor/pixi.toml +++ /dev/null @@ -1,98 +0,0 @@ -[project] -name = "my installer" -version = "0.1.0" -channels = ["conda-forge"] -platforms = ["linux-64", "linux-aarch64", "linux-ppc64le", "osx-64", "osx-arm64", "win-64"] - -[environments] -installer = ["installer"] -build-linux = ["build", "build-linux"] -build-osx = ["build", "build-osx", "build-win"] -build-win = ["build", "build-win"] - -[feature.installer.dependencies] -python = "*" # constructor requires this -micromamba = "*" # provide `bin/activate` (or `Scripts/activate`) - -[feature.build.dependencies] -constructor = "*" -jaq = "*" -micromamba = "*" - -[feature.build.tasks] -platform = "pixi info --json | jaq -r '.platform'" -specs = {cmd=""" - pixi project export conda-explicit-spec --environment installer ./installer/specs -""", inputs=["pixi.lock"], outputs=["installer/specs"]} -construct = """ - rm -rf dist/installer/$CC_PLATFORM - && constructor installer - --platform $CC_PLATFORM - --cache-dir build/.cache/constructor - --output-dir dist/installer/$CC_PLATFORM - --conda-exe $(which micromamba) -""" - -[feature.build-linux] -platforms = ["linux-64", "linux-aarch64", "linux-ppc64le"] -[feature.build-linux.tasks] -build = {depends-on = ["specs", "build-linux-64", "build-linux-aarch64", "build-linux-ppc64le"]} -build-linux-64 = {cmd=""" - CC_PLATFORM=linux-64 pixi run construct -""", outputs=["dist/installer/linux-64"], inputs=[ - "installer/{construct.yaml,specs/installer_linux-64_conda_spec.txt}", -]} -build-linux-aarch64 = {cmd=""" - CC_PLATFORM=linux-aarch64 pixi run construct -""", outputs=["dist/installer/linux-aarch64"], inputs=[ - "installer/{construct.yaml,specs/installer_linux-aarch64_conda_spec.txt}", -]} -build-linux-ppc64le = {cmd=""" - CC_PLATFORM=linux-ppc64le pixi run construct -""", outputs=["dist/installer/linux-ppc64le"], inputs=[ - "installer/{construct.yaml,specs/installer_linux-ppc64le_conda_spec.txt}", -]} -start = {depends-on = ["build"], cmd = """ - rm -rf build/_installer_env_/ - && bash dist/installer/$(pixi run platform)/*.sh -fbp build/_installer_env_/ -"""} - -[feature.build-osx] -platforms = ["osx-64", "osx-arm64"] -[feature.build-osx.tasks] -build = {depends-on = ["specs", "build-osx-64", "build-osx-arm64"]} -build-osx-64 = {cmd=""" - CC_PLATFORM=osx-64 pixi run construct -""", outputs=["dist/installer/osx-64"], inputs=[ - "installer/{construct.yaml,specs/installer_osx-64_conda_spec.txt}", -]} -build-osx-arm64 = {cmd=""" - CC_PLATFORM=osx-arm64 pixi run construct -""", outputs=["dist/installer/osx-arm64"], inputs=[ - "installer/{construct.yaml,specs/installer_osx-arm64_conda_spec.txt}", -]} -start = {depends-on = ["build"], cmd = """ - rm -rf build/_installer_env_/ - && bash dist/installer/$(pixi run platform)/*.sh -fbp build/_installer_env_/ -"""} - -[feature.build-win] -platforms = ["win-64"] -[feature.build-win.tasks] -build = {depends-on = ["specs", "build-win-64"]} -build-win-64 = {cmd=""" - CC_PLATFORM=win-64 pixi run construct -""", outputs=["dist/installer/win-64"], inputs=[ - "installer/{construct.yaml,specs/installer_win-64_conda_spec.txt}", -]} -start = {depends-on = ["build"], cmd = ''' -rm -rf build/_installer_env_/ -&& start - /wait - "" - dist\installer\$(pixi run platform)\*.exe - /InstallationType=JustMe - /RegisterPython=0 - /S - /D=build\_installer_env_ -'''} From c8601f4647286d995b402e6219c4bd98907e0190 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Fri, 20 Sep 2024 13:15:40 -0500 Subject: [PATCH 3/4] generate construct.yaml from .in --- examples/constructor-minimal/.gitignore | 1 + .../installer/{construct.yaml => construct.yaml.in} | 4 ---- examples/constructor-minimal/pixi.toml | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) rename examples/constructor-minimal/installer/{construct.yaml => construct.yaml.in} (74%) diff --git a/examples/constructor-minimal/.gitignore b/examples/constructor-minimal/.gitignore index 7eb27b27a..67c6849b5 100644 --- a/examples/constructor-minimal/.gitignore +++ b/examples/constructor-minimal/.gitignore @@ -1,3 +1,4 @@ specs/ dist/ build/ +construct.yaml diff --git a/examples/constructor-minimal/installer/construct.yaml b/examples/constructor-minimal/installer/construct.yaml.in similarity index 74% rename from examples/constructor-minimal/installer/construct.yaml rename to examples/constructor-minimal/installer/construct.yaml.in index 518f42ffc..3e0f7f6f4 100644 --- a/examples/constructor-minimal/installer/construct.yaml +++ b/examples/constructor-minimal/installer/construct.yaml.in @@ -1,6 +1,4 @@ # see https://github.com/conda/constructor/blob/main/CONSTRUCT.md -{% set spec = "./specs/installer_" ~ environ.CC_PLATFORM ~ "_conda_spec.txt" %} - name: MySimpleInstaller version: 0.1.0 company: My Company @@ -9,8 +7,6 @@ license_file: ../LICENSE channels: - conda-forge -environment_file: "{{ spec }}" - write_condarc: True initialize_conda: True initialize_by_default: False diff --git a/examples/constructor-minimal/pixi.toml b/examples/constructor-minimal/pixi.toml index 47244433e..14de03207 100644 --- a/examples/constructor-minimal/pixi.toml +++ b/examples/constructor-minimal/pixi.toml @@ -29,6 +29,9 @@ mamba = "*" # needed for cross-architecturo solves [feature.build.tasks] construct = """ rm -rf dist/installer/$CC_PLATFORM + && cat installer/construct.yaml.in > installer/construct.yaml + && echo "environment_file: ./specs/installer_$(echo $CC_PLATFORM)_conda_spec.txt" + >> installer/construct.yaml && constructor installer --platform $CC_PLATFORM --cache-dir build/.cache/constructor From 51805466e2fe9b4b7c14486517659a7436475e0d Mon Sep 17 00:00:00 2001 From: Ruben Arts Date: Mon, 23 Sep 2024 15:20:20 +0200 Subject: [PATCH 4/4] fmt --- examples/constructor-minimal/pixi.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/constructor-minimal/pixi.toml b/examples/constructor-minimal/pixi.toml index 14de03207..6bb2f2903 100644 --- a/examples/constructor-minimal/pixi.toml +++ b/examples/constructor-minimal/pixi.toml @@ -27,7 +27,7 @@ jaq = "*" # needed to get current platform mamba = "*" # needed for cross-architecturo solves [feature.build.tasks] -construct = """ +construct = { cmd = """ rm -rf dist/installer/$CC_PLATFORM && cat installer/construct.yaml.in > installer/construct.yaml && echo "environment_file: ./specs/installer_$(echo $CC_PLATFORM)_conda_spec.txt" @@ -37,7 +37,7 @@ construct = """ --cache-dir build/.cache/constructor --output-dir dist/installer/$CC_PLATFORM --conda-exe $(which mamba || where mamba) -""" +""", env = { CONDA_EXE = "$(which mamba || where mamba)" } } platform = "pixi info --json | jaq -r '.platform'" specs = "pixi project export conda-explicit-spec --environment installer ./installer/specs"