Split projects (#1219)

* make a clear split between CMake targets
* split versions between libmamba and mamba
* add libmambapy target for python bindings and make mamba depend on it
* rename CMake options to make them homogeneous, simplify CMake
* remove termcolor from thirdparties, use it as a dependency
* remove unnecessary version global vars and convert to functions
* update CI workflows
This commit is contained in:
Adrien Delsalle 2021-10-26 16:01:53 +02:00 committed by GitHub
parent 8cdc82982b
commit bff16c2bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
251 changed files with 3380 additions and 1825 deletions

View File

@ -1,4 +1,4 @@
[flake8]
max-line-length=88
max-line-length=100
extend-ignore=E203,D104,D100,I004
exclude=test/*,docs/source/tools/*
exclude=*/tests/*,docs/source/tools/*

View File

@ -9,108 +9,7 @@ on:
- master
jobs:
mamba_python_tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8"]
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: free disk space
if: matrix.os == 'ubuntu-latest'
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache
- name: Conda info
shell: bash -l {0}
run: conda info
- name: Create the conda environment
shell: bash -l {0}
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install -n base python=$PYTHON_VERSION pip pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json "cpp-filesystem>=1.5.8" conda cxx-compiler ccache cmake gtest gmock reproc-cpp yaml-cpp
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash -l {0}
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate base
python --version
export CCACHE_DIR=$HOME/ccache
ccache --show-config
export CC="ccache $CC"
if [ "$RUNNER_OS" == "macOS" ]; then
export LDSHARED=$(python -c "import os;from distutils import sysconfig;print(sysconfig.get_config_var('LDSHARED'))")
fi
python -m pip install ".[test]" -vvv
ccache --print-stats
- name: Run tests OS X and Linux
shell: bash -l {0}
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate base
pytest test --ignore=test/micromamba
mamba create -n test_env xtensor -c conda-forge -y
mamba env create -f test/test_env.yml
mamba env update -f test/update_env.yml
- name: Run tests OS X and Linux
shell: bash -l {0}
run: |
conda activate base
conda install conda-build -c conda-forge -y
if [ "$RUNNER_OS" == "Linux" ]; then
mkdir -p $CONDA_PREFIX/conda-bld/linux-64
wget -P $CONDA_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/linux-64/xtensor-0.21.8-hc9558a2_0.tar.bz2
wget -P $CONDA_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/linux-64/xtl-0.6.21-h0efe328_0.tar.bz2
else
mkdir -p $CONDA_PREFIX/conda-bld/osx-64
wget -P $CONDA_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/osx-64/xtensor-0.21.8-h879752b_0.tar.bz2
wget -P $CONDA_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/osx-64/xtl-0.6.21-h6516342_0.tar.bz2
fi
conda index $CONDA_PREFIX/conda-bld
mamba create -n l_o_cal_test xtensor -c local -c conda-forge -y
conda activate l_o_cal_test
conda list
conda list | tail -n +3 > list.txt
if [ "$(grep -c "local" list.txt)" -ne 2 ]; then
exit 1
fi
- name: Run server auth tests
shell: bash -l {0} -euo pipefail -x
run: |
cd test
source "$CONDA/etc/profile.d/conda.sh"
conda activate base
if [[ "$(uname -s)" == "Linux" ]]; then
./generate_gpg_keys.sh
pip install securesystemslib
fi
pip install rich
pip install git+https://github.com/conda/conda-content-trust.git@master
./testserver.sh
libmamba_cpp_tests:
libmamba_static:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@ -126,53 +25,79 @@ jobs:
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Cache CCACHE paths
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%F)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-libmamba
- name: install micromamba
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
wget -qO- https://api.anaconda.org/download/conda-forge/micromamba/0.4.0/linux-64/micromamba-0.4.0-hc2cb875_0.tar.bz2 | tar -xvj bin/micromamba --strip-components=1
else
wget -qO- https://anaconda.org/conda-forge/micromamba/0.4.0/download/osx-64/micromamba-0.4.0-h8680c10_1.tar.bz2 | tar -xvj bin/micromamba
mv bin/micromamba ./micromamba
fi
./micromamba shell init -s bash -p ~/mambaroot
- name: install deps
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./libmamba/environment-dev.yml
environment-name: build_env
- name: build libmamba-static
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
. $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh
micromamba create -y -p ~/build_env pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json cxx-compiler ccache cmake gtest gmock "cpp-filesystem>=1.5.8" reproc-cpp yaml-cpp cli11 -c conda-forge
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: build tests
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
. $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh
micromamba activate ~/build_env
mkdir -p ~/.conda
touch ~/.conda/environments.txt
micromamba activate build_env
mkdir build
cd build
export CCACHE_DIR=$HOME/ccache
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DENABLE_TESTS=ON \
-DBUILD_EXE=ON \
-DBUILD_CRYPTO_PACKAGE_VALIDATION=ON \
-DBUILD_BINDINGS=OFF \
cmake \
-GNinja \
-DBUILD_LIBMAMBA=ON \
-DBUILD_STATIC=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache
make test_mamba_lock -j2
make test -j2
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
..
ninja
libmamba_cpp_tests:
needs: [libmamba_static]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%F)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./libmamba/environment-dev.yml
environment-name: build_env
- name: build and run libmamba C++ tests
shell: bash -l {0}
run: |
micromamba activate build_env
mkdir build
cd build
export CCACHE_DIR=$HOME/ccache
cmake \
-GNinja \
-DBUILD_LIBMAMBA_TESTS=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
..
ninja testing_libmamba_lock
ninja test
umamba_tests:
needs: [libmamba_static]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@ -188,93 +113,34 @@ jobs:
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Cache CCACHE paths
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%F)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-umamba
- name: install micromamba
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
wget -qO- https://api.anaconda.org/download/conda-forge/micromamba/0.4.0/linux-64/micromamba-0.4.0-hc2cb875_0.tar.bz2 | tar -xvj bin/micromamba --strip-components=1
else
wget -qO- https://anaconda.org/conda-forge/micromamba/0.4.0/download/osx-64/micromamba-0.4.0-h8680c10_1.tar.bz2 | tar -xvj bin/micromamba
mv bin/micromamba ./micromamba
fi
./micromamba shell init -s bash -p ~/mambaroot
- name: install deps
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
. $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh
micromamba create -y -p ~/build_env pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json cxx-compiler ccache cmake gtest gmock "cpp-filesystem>=1.5.8" reproc-cpp yaml-cpp pyyaml cli11 -c conda-forge
env:
PYTHON_VERSION: ${{ matrix.python-version }}
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./micromamba/environment-dev.yml
environment-name: build_env
- name: build micromamba
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
. $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh
micromamba activate ~/build_env
micromamba activate build_env
export CCACHE_DIR=$HOME/ccache
mkdir -p ~/.conda
touch ~/.conda/environments.txt
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DENABLE_TESTS=OFF \
-DBUILD_EXE=ON \
-DBUILD_BINDINGS=OFF \
cmake .. \
-GNinja \
-DBUILD_MICROMAMBA=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache
make -j2
- name: run new micromamba
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
cd build
./micromamba --version
if [ "$RUNNER_OS" == "Linux" ]; then
./micromamba create -p ~/explicit_env -f ../test/explicit_env_linux.txt
else
./micromamba create -p ~/explicit_env -f ../test/explicit_env_osx.txt
fi;
- name: run new micromamba yaml env
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
cd build
./micromamba create -f ../test/yaml_env.yml
- name: run new micromamba spec files
shell: bash -l {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
cd build
./micromamba create -f ../test/spec_file_1.txt -n testenv_one_file -c conda-forge
./micromamba create -f ../test/spec_file_1.txt -f ../test/spec_file_2.txt -n testenv_two_files -c conda-forge
# test noarch packages
$MAMBA_ROOT_PREFIX/envs/testenv_two_files/bin/wheel --help
- name: micromamba prefix replacement / pkgconfig check
shell: bash -l -eo pipefail {0}
run: |
cd build
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/micromamba
eval "$($MAMBA_EXE shell hook -s posix -p ~/mambaroot)"
micromamba create -n pkgconf pkg-config=0.29.2 eigen -c conda-forge
micromamba activate pkgconf
IDIR=$(pkg-config eigen3 --cflags-only-I)
if [[ "${IDIR}" != "-I$CONDA_PREFIX/include/eigen3" ]];
then
exit 1;
fi
ninja
- name: install zsh, xonsh and fish in linux
if: matrix.os == 'ubuntu-latest'
shell: bash -l -eo pipefail {0}
@ -288,15 +154,156 @@ jobs:
- name: micromamba python based tests
shell: bash -l -eo pipefail {0}
run: |
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_EXE=$(pwd)/build/micromamba
eval "$($MAMBA_EXE shell hook -s posix -p ~/mambaroot)"
export TEST_MAMBA_EXE=$(pwd)/build/micromamba/micromamba
micromamba activate build_env
pytest ./micromamba/tests/
micromamba activate
micromamba install python=3.8 pytest pyyaml pytest-lazy-fixture -c conda-forge
mamba_python_tests:
needs: [libmamba_static]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8"]
export TEST_MAMBA_EXE=$(pwd)/build/micromamba
pytest test/micromamba
steps:
- uses: actions/checkout@v2
- name: free disk space
if: matrix.os == 'ubuntu-latest'
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%F)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./mamba/environment-dev.yml
environment-name: build_env
extra-specs: conda-build
- name: run conda init
shell: bash -l {0}
run: conda init
- name: build libmamba Python bindings
shell: bash -l {0}
run: |
micromamba activate build_env
mkdir build
cd build
export CCACHE_DIR=$HOME/ccache
cmake \
-GNinja \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DBUILD_LIBMAMBAPY=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
..
ninja
ninja install
pip install -e ../libmambapy/ --no-deps
- name: install mamba
shell: bash -l {0}
run: |
micromamba activate build_env
pip install ./mamba[test] --no-deps
- name: run mamba tests suite
shell: bash -l {0}
run: |
micromamba activate build_env
pytest mamba/tests
- name: run mamba create/update tests
shell: bash -l {0}
run: |
micromamba activate build_env
mamba create -n test_env xtensor -c conda-forge -y
mamba env create -f mamba/tests/test_env.yml
mamba env update -f mamba/tests/update_env.yml
- name: run mamba local channel test
shell: bash -l {0}
run: |
micromamba activate build_env
if [ "$RUNNER_OS" == "Linux" ]; then
mkdir -p $CONDA_PREFIX/conda-bld/linux-64
wget -P $CONDA_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/linux-64/xtensor-0.21.8-hc9558a2_0.tar.bz2
wget -P $CONDA_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/linux-64/xtl-0.6.21-h0efe328_0.tar.bz2
else
mkdir -p $CONDA_PREFIX/conda-bld/osx-64
wget -P $CONDA_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/osx-64/xtensor-0.21.8-h879752b_0.tar.bz2
wget -P $CONDA_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/osx-64/xtl-0.6.21-h6516342_0.tar.bz2
fi
conda index $CONDA_PREFIX/conda-bld
mamba create -n l_o_cal_test xtensor -c local -c conda-forge -y
conda list -n l_o_cal_test
conda list -n l_o_cal_test | tail -n +3 > list.txt
if [ "$(grep -c "local" list.txt)" -ne 2 ]; then
exit 1
fi
- name: Run server auth tests
shell: bash -l {0} -euo pipefail -x
run: |
micromamba activate build_env
cd mamba/tests
if [[ "$(uname -s)" == "Linux" ]]; then
./generate_gpg_keys.sh
pip install securesystemslib
fi
pip install rich
pip install git+https://github.com/conda/conda-content-trust.git@master
./testserver.sh
# libmamba_static_win:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-2016]
# steps:
# - uses: actions/checkout@v2
# - name: generate ccache timestamp
# id: ccache_cache_timestamp
# shell: bash -l {0}
# run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
# - name: cache CCACHE paths
# uses: actions/cache@v2
# with:
# path: |
# ~/ccache
# key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
# - name: create build environment
# uses: mamba-org/provision-with-micromamba@main
# with:
# environment-file: ./libmamba/environment-dev.yml
# environment-name: build_env
# - name: build libmamba-static
# shell: cmd /C call {0}
# run: |
# call micromamba activate build_env
# mkdir build
# cd build
# set CCACHE_DIR=%HOME%\ccache
# cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
# -DBUILD_LIBMAMBA=ON ^
# -DBUILD_STATIC=ON ^
# -GNinja ^
# -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
# -DCMAKE_C_COMPILER_LAUNCHER=ccache
# ninja -j2
mamba_python_tests_win:
runs-on: ${{ matrix.os }}
@ -308,67 +315,74 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache CCACHE paths
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-mamba
- uses: conda-incubator/setup-miniconda@v2
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Conda info
run: conda info
- name: Create the conda environment
environment-file: ./mamba/environment-dev.yml
environment-name: build_env
extra-specs: |
conda-build
curl
- name: run conda init
shell: bash -l {0}
run: conda init
- name: build libmamba Python bindings
shell: cmd /C call {0}
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install -n base -q -y vs2017_win-64 ccache python=$PYTHON_VERSION pip pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json "cpp-filesystem>=1.5.8" conda cmake gtest gmock ninja reproc-cpp yaml-cpp cli11
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Install dependencies
call micromamba activate build_env
mkdir build
cd build
set CCACHE_DIR=%HOME%\ccache
cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library -DBUILD_LIBMAMBAPY=ON ^
-GNinja ^
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
-DCMAKE_C_COMPILER_LAUNCHER=ccache
ninja
ninja install
pip install -e ..\libmambapy\ --no-deps
- name: install mamba
shell: bash -l {0}
run: |
conda activate base
python --version
$Env:CCACHE_DIR="$HOME/ccache"
ccache --show-config
$Env:CC="ccache $Env:CC"
$Env:CXX="ccache $Env:CXX"
python -m pip install ".[test]" -vvv
ccache --print-stats
- name: Run pytests on Windows
run: |
conda activate base
pytest test --ignore=test/micromamba
pip install ./mamba[test] --no-deps
- name: run mamba tests suite
shell: bash -l {0}
run: pytest mamba/tests
- name: Run create command
run: |
conda activate base
mamba create -n test_env xtensor -c conda-forge -y
shell: bash -l {0}
run: mamba create -n test_env xtensor -c conda-forge -y
- name: Run env create command
run: |
conda activate base
mamba env create -f test/test_env.yml
shell: bash -l {0}
run: mamba env create -f mamba/tests/test_env.yml
- name: Run env update command
run: |
conda activate base
mamba env update -f test/update_env.yml
shell: bash -l {0}
run: mamba env update -f mamba/tests/update_env.yml
- name: Run local channel checks
shell: bash -l {0}
run: |
conda activate base
conda install conda-build -c conda-forge -y
mkdir -p $CONDA_PREFIX/conda-bld/win-64
echo $PATH
micromamba list
micromamba info
curl --version
curl https://anaconda.org/conda-forge/xtensor/0.21.7/download/win-64/xtensor-0.21.7-h7ef1ec2_0.tar.bz2 -L -o $CONDA_PREFIX/conda-bld/win-64/xtensor-0.21.7-h7ef1ec2_0.tar.bz2
curl https://anaconda.org/conda-forge/xtl/0.6.21/download/win-64/xtl-0.6.21-h5362a0b_0.tar.bz2 -L -o $CONDA_PREFIX/conda-bld/win-64/xtl-0.6.21-h5362a0b_0.tar.bz2
conda index $CONDA_PREFIX/conda-bld
mamba create -n l_o_cal_test xtensor -c local -c conda-forge -y
conda activate l_o_cal_test
conda list
conda list -n l_o_cal_test
# cut first couple of lines to remove prefix path
conda list | tail -n +3 > list.txt
conda list -n l_o_cal_test | tail -n +3 > list.txt
if [ "$(grep -c "local" list.txt)" -ne 2 ]; then
exit 1
fi
@ -383,37 +397,33 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Cache CCACHE paths
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-libmamba
- name: Conda info
run: conda info
- name: Create the conda environment
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./libmamba/environment-dev.yml
environment-name: build_env
- name: build and run libmamba C++ tests
shell: cmd /C call {0}
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -q -y -n mamba-tests vs2017_win-64 ccache python=$PYTHON_VERSION pip pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json "cpp-filesystem>=1.5.8" conda cmake gtest gmock ninja reproc-cpp yaml-cpp cli11 pytest
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Run C++ tests Windows
shell: cmd
run: |
call conda activate mamba-tests
call micromamba activate build_env
mkdir build
cd build
set "CCACHE_DIR=%HOME%\ccache"
cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library -DENABLE_TESTS=ON ^
-G "Ninja" ^
set CCACHE_DIR=%HOME%\ccache
cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library -DBUILD_LIBMAMBA_TESTS=ON ^
-GNinja ^
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
-DCMAKE_C_COMPILER_LAUNCHER=ccache
ninja test_mamba_lock -j2
ninja testing_libmamba_lock -j2
ninja test -j2
umamba_tests_win:
@ -426,58 +436,36 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache CCACHE paths
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-umamba
- name: create empty mamba-test env
shell: bash -l -eo pipefail {0}
run: |
cat > environment-test.yml <<EOL
name: mamba-test
dependencies:
- python
channels:
- conda-forge
EOL
- name: bootstrap test env with micromamba
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: environment-test.yml
- name: finalize test env
shell: powershell
environment-file: ./micromamba/environment-dev.yml
environment-name: build_env
- name: build micromamba
shell: cmd /C call {0}
run: |
micromamba -n mamba-test install vs2017_win-64 python=$PYTHON_VERSION -f environment-dev.yml
micromamba shell init -s cmd.exe -y -p $HOME\micromamba
- name: mamba info
shell: powershell
run: micromamba info
- name: Build micromamba on Windows
shell: cmd
run: |
call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate mamba-test
call micromamba activate build_env
mkdir build
cd build
set "CCACHE_DIR=%HOME%\ccache"
cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library -DBUILD_EXE=ON -G "Ninja" ^
set CCACHE_DIR=%HOME%\ccache
cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library -DBUILD_MICROMAMBA=ON ^
-GNinja ^
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
-DCMAKE_C_COMPILER_LAUNCHER=ccache
ninja
.\micromamba.exe --help
- name: Install "wheel" in micromamba default env
shell: powershell
run: |
micromamba activate mamba-test
cd build
.\micromamba.exe shell hook --no-auto-activate-base -s powershell | Out-String | Invoke-Expression
cd \
micromamba create -n testenv python=3.8 wheel -c conda-forge
micromamba activate testenv
wheel --help
- name: "Tar files"
run: tar -cvf umamba.tar build/micromamba.exe
ninja -j2
.\micromamba\micromamba.exe --help
- name: tar micromamba artifact
run: tar -cvf umamba.tar build/micromamba/micromamba.exe
- uses: actions/upload-artifact@v2
with:
name: micromamba_binary
@ -494,35 +482,39 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v2
with:
name: micromamba_binary
- name: Untar binary
- name: untar micromamba artifact
shell: bash -l -eo pipefail {0}
run: |
tar -xvf umamba.tar
- name: Create the conda environment
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -q -y -n mamba-tests vs2017_win-64 python=$PYTHON_VERSION pip pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json "cpp-filesystem>=1.5.8" conda cmake gtest gmock ninja reproc-cpp yaml-cpp pyyaml cli11 pytest pytest-lazy-fixture menuinst
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./micromamba/environment-dev.yml
environment-name: build_env
extra-specs: menuinst
- name: micromamba python based tests
shell: cmd
shell: cmd /C call {0}
run: |
call conda activate mamba-tests
call micromamba activate build_env
set MAMBA_ROOT_PREFIX=%cd%\mambaroot
set MAMBA_TEST_SHELL_TYPE=cmd.exe
reg delete HKEY_CURRENT_USER\Software\Microsoft\Command Processor /v AutoRun
pytest test/micromamba
pytest micromamba/tests
umamba_tests_win_pwsh:
needs: [umamba_tests_win]
@ -535,10 +527,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v2
with:
name: micromamba_binary
@ -546,22 +534,30 @@ jobs:
shell: bash -l -eo pipefail {0}
run: |
tar -xvf umamba.tar
- name: Create the conda environment
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -q -y -n mamba-tests vs2017_win-64 python=$PYTHON_VERSION pip pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json "cpp-filesystem>=1.5.8" conda cmake gtest gmock ninja reproc-cpp yaml-cpp pyyaml cli11 pytest pytest-lazy-fixture menuinst
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./micromamba/environment-dev.yml
environment-name: build_env
extra-specs: menuinst
- name: micromamba python based tests with pwsh
shell: powershell
run: |
conda activate mamba-tests
micromamba activate build_env
$env:MAMBA_ROOT_PREFIX = Join-Path -Path $pwd -ChildPath 'mambaroot'
$env:MAMBA_TEST_SHELL_TYPE='powershell'
pytest test/micromamba
pytest micromamba/tests
umamba_tests_win_bash:
needs: [umamba_tests_win]
@ -574,10 +570,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v2
with:
name: micromamba_binary
@ -585,19 +577,27 @@ jobs:
shell: bash -l -eo pipefail {0}
run: |
tar -xvf umamba.tar
- name: Create the conda environment
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -q -y -n mamba-tests vs2017_win-64 python=$PYTHON_VERSION pip pybind11 libsolv libsodium libarchive "libcurl=7.76.1=*_0" nlohmann_json "cpp-filesystem>=1.5.8" conda cmake gtest gmock ninja reproc-cpp yaml-cpp pyyaml cli11 pytest pytest-lazy-fixture menuinst
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: generate ccache timestamp
id: ccache_cache_timestamp
shell: bash -l {0}
run: echo ::set-output name=timestamp::"$(date --utc +%FT%H)"
- name: cache CCACHE paths
uses: actions/cache@v2
with:
path: |
~/ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ./micromamba/environment-dev.yml
environment-name: build_env
extra-specs: menuinst
- name: micromamba python based tests
shell: bash -l -eo pipefail {0}
run: |
conda activate mamba-tests
micromamba activate build_env
export MAMBA_ROOT_PREFIX=~/mambaroot
export MAMBA_TEST_SHELL_TYPE=bash
pytest test/micromamba
pytest micromamba/tests

View File

@ -8,182 +8,24 @@ cmake_minimum_required (VERSION 3.2)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
cmake_policy(SET CMP0077 NEW)
#if(POLICY CMP0028)
# cmake_policy(SET CMP0028 NEW)
#endif()
project(mamba)
set(MAMBA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(MAMBA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
# Versionning
# ===========
# Getting the mamba version from python
file (READ mamba/_version.py VERSION_FILE)
STRING(REGEX REPLACE "\r?\n" ";" TMP_VERSION_FILE_LIST "${VERSION_FILE}")
LIST(GET TMP_VERSION_FILE_LIST 0 VERSION_LINE)
string(REGEX MATCHALL "version_info = \\(([0-9]*), ([0-9]*), ([0-9]*)\\)" MATCHES ${VERSION_LINE})
set(MAMBA_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(MAMBA_VERSION_MINOR "${CMAKE_MATCH_2}")
set(MAMBA_VERSION_PATCH "${CMAKE_MATCH_3}")
message("--> mamba version: ${MAMBA_VERSION_MAJOR}.${MAMBA_VERSION_MINOR}.${MAMBA_VERSION_PATCH}")
# Binary version
# See the following URL for explanations about the binary versionning
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
file(STRINGS "${MAMBA_INCLUDE_DIR}/mamba/core/version.hpp.in" mamba_version_defines
REGEX "#define MAMBA_BINARY_(CURRENT|REVISION|AGE)")
foreach(ver ${mamba_version_defines})
if(ver MATCHES "#define MAMBA_BINARY_(CURRENT|REVISION|AGE) +([^ ]+)$")
set(MAMBA_BINARY_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(MAMBA_BINARY_VERSION
${MAMBA_BINARY_CURRENT}.${MAMBA_BINARY_REVISION}.${MAMBA_BINARY_AGE})
message(STATUS "mamba binary version: v${MAMBA_BINARY_VERSION}")
configure_file(${MAMBA_INCLUDE_DIR}/mamba/core/version.hpp.in
${CMAKE_SOURCE_DIR}/include/mamba/core/version.hpp @ONLY)
# Build options
# =============
option(BUILD_EXE "" OFF)
option(BUILD_MICROMAMBA "Build micromamba" OFF)
option(BUILD_LIBMAMBA "Build libmamba library" OFF)
option(BUILD_LIBMAMBAPY "Build libmamba Python bindings" OFF)
option(BUILD_LIBMAMBA_TESTS "Build libmamba C++ tests" OFF)
option(MICROMAMBA_STATIC_LINK "" OFF)
option(BUILD_SHARED "" OFF)
option(BUILD_STATIC "" ON)
option(BUILD_BINDINGS "" ON)
option(STATIC_DEPENDENCIES "" OFF)
option(BUILD_CRYPTO_PACKAGE_VALIDATION "Enable package validation using TUF" OFF)
option(ENABLE_TESTS "Enable C++ tests for mamba" OFF)
if (STATIC_DEPENDENCIES)
add_definitions(-DUMAMBA_STATIC)
endif()
add_definitions(-DGHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
# Dependencies
# ============
find_package(Threads REQUIRED)
find_package(nlohmann_json REQUIRED)
message("Found libraries: ${MAMBA_DEPENDENCIES_LIBS}")
# Source files
# ============
set(MAMBA_SOURCES
# Core API (low-level)
${MAMBA_SOURCE_DIR}/core/activation.cpp
${MAMBA_SOURCE_DIR}/core/channel.cpp
${MAMBA_SOURCE_DIR}/core/context.cpp
${MAMBA_SOURCE_DIR}/core/environments_manager.cpp
${MAMBA_SOURCE_DIR}/core/fetch.cpp
${MAMBA_SOURCE_DIR}/core/transaction_context.cpp
${MAMBA_SOURCE_DIR}/core/link.cpp
${MAMBA_SOURCE_DIR}/core/history.cpp
${MAMBA_SOURCE_DIR}/core/match_spec.cpp
${MAMBA_SOURCE_DIR}/core/menuinst.cpp
${MAMBA_SOURCE_DIR}/core/url.cpp
${MAMBA_SOURCE_DIR}/core/output.cpp
${MAMBA_SOURCE_DIR}/core/package_handling.cpp
${MAMBA_SOURCE_DIR}/core/package_cache.cpp
${MAMBA_SOURCE_DIR}/core/pool.cpp
${MAMBA_SOURCE_DIR}/core/prefix_data.cpp
${MAMBA_SOURCE_DIR}/core/progress_bar.cpp
${MAMBA_SOURCE_DIR}/core/pinning.cpp
${MAMBA_SOURCE_DIR}/core/package_info.cpp
${MAMBA_SOURCE_DIR}/core/package_paths.cpp
${MAMBA_SOURCE_DIR}/core/query.cpp
${MAMBA_SOURCE_DIR}/core/repo.cpp
${MAMBA_SOURCE_DIR}/core/shell_init.cpp
${MAMBA_SOURCE_DIR}/core/solver.cpp
${MAMBA_SOURCE_DIR}/core/subdirdata.cpp
${MAMBA_SOURCE_DIR}/core/thread_utils.cpp
${MAMBA_SOURCE_DIR}/core/transaction.cpp
${MAMBA_SOURCE_DIR}/core/util.cpp
${MAMBA_SOURCE_DIR}/core/util_os.cpp
${MAMBA_SOURCE_DIR}/core/validate.cpp
${MAMBA_SOURCE_DIR}/core/version.cpp
${MAMBA_SOURCE_DIR}/core/virtual_packages.cpp
# API (high-level)
${MAMBA_SOURCE_DIR}/api/c_api.cpp
${MAMBA_SOURCE_DIR}/api/clean.cpp
${MAMBA_SOURCE_DIR}/api/config.cpp
${MAMBA_SOURCE_DIR}/api/configuration.cpp
${MAMBA_SOURCE_DIR}/api/create.cpp
${MAMBA_SOURCE_DIR}/api/info.cpp
${MAMBA_SOURCE_DIR}/api/install.cpp
${MAMBA_SOURCE_DIR}/api/list.cpp
${MAMBA_SOURCE_DIR}/api/remove.cpp
${MAMBA_SOURCE_DIR}/api/shell.cpp
${MAMBA_SOURCE_DIR}/api/update.cpp
)
set(MAMBA_THIRD_PARTIES
${MAMBA_SOURCE_DIR}/thirdparty/WinReg.hpp
${MAMBA_SOURCE_DIR}/thirdparty/termcolor.hpp
)
set(MAMBA_HEADERS
# Core API (low-level)
${MAMBA_INCLUDE_DIR}/mamba/core/activation.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/channel.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/context.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/environment.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/environments_manager.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/fetch.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/fsutil.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/graph_util.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/history.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/link.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/mamba_fs.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/match_spec.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/menuinst.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/output.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/package_cache.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/package_handling.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/package_info.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/package_paths.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/pool.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/prefix_data.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/progress_bar.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/pinning.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/query.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/repo.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/shell_init.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/solver.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/subdirdata.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/thread_utils.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/transaction.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/transaction_context.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/url.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/util.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/util_os.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/validate.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/version.hpp
${MAMBA_INCLUDE_DIR}/mamba/core/virtual_packages.hpp
# API (high-level)
${MAMBA_INCLUDE_DIR}/mamba/api/c_api.h
${MAMBA_INCLUDE_DIR}/mamba/api/clean.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/config.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/configuration.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/constants.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/create.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/info.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/install.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/list.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/remove.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/shell.hpp
${MAMBA_INCLUDE_DIR}/mamba/api/update.hpp
)
# Targets and link
# ================
option(BUILD_STATIC "" OFF)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNOMINMAX")
@ -193,168 +35,29 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
macro(mamba_create_target target_name linkage output_name)
string(TOUPPER "${linkage}" linkage_upper)
# Variants
# ========
if (NOT ${linkage_upper} MATCHES "^(SHARED|STATIC)$")
message(FATAL_ERROR "Invalid library linkage: ${linkage}")
if (BUILD_MICROMAMBA OR BUILD_LIBMAMBA_TESTS OR BUILD_LIBMAMBAPY)
set(BUILD_LIBMAMBA ON)
set(BUILD_STATIC ON)
endif()
# Output
# ======
add_library(${target_name} ${linkage_upper} ${MAMBA_SOURCES} ${MAMBA_HEADERS} ${MAMBA_THIRD_PARTIES})
if (NOT STATIC_DEPENDENCIES)
find_library(LIBSOLV_LIBRARIES NAMES solv)
find_library(LIBSOLVEXT_LIBRARIES NAMES solvext)
find_package(CURL REQUIRED)
find_package(LibArchive REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(yaml-cpp CONFIG REQUIRED)
find_package(reproc++ CONFIG REQUIRED)
set(MAMBA_DEPENDENCIES_LIBS
${LIBSOLV_LIBRARIES}
${LIBSOLVEXT_LIBRARIES}
${LibArchive_LIBRARIES}
${CURL_LIBRARIES}
${OPENSSL_LIBRARIES}
${YAML_CPP_LIBRARIES}
reproc++
)
target_link_libraries(${target_name} PUBLIC
${MAMBA_DEPENDENCIES_LIBS}
${MAMBA_FORCE_DYNAMIC_LIBS}
nlohmann_json::nlohmann_json
Threads::Threads)
endif()
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD 17)
target_include_directories(
${target_name}
PUBLIC
$<BUILD_INTERFACE:${MAMBA_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>
)
target_include_directories(
${target_name}
PRIVATE ${MAMBA_SOURCE_DIR}
)
set_target_properties(
${target_name}
PROPERTIES
PUBLIC_HEADER "${MAMBA_HEADERS}"
COMPILE_DEFINITIONS "MAMBA_EXPORTS"
PREFIX ""
VERSION ${MAMBA_BINARY_VERSION}
SOVERSION ${MAMBA_BINARY_CURRENT}
OUTPUT_NAME "lib${output_name}"
)
endmacro()
set(mamba_targets "")
if (BUILD_SHARED)
message(STATUS "BUILDING SHARED")
mamba_create_target(mamba SHARED mamba)
list(APPEND mamba_targets mamba)
# libmamba library and tests
if (BUILD_LIBMAMBA)
if (BUILD_LIBMAMBA_TESTS)
set(BUILD_TESTS ON)
endif()
if (BUILD_STATIC)
message(STATUS "BUILDING STATIC")
# On Windows, a static library should use a different output name
# to avoid the conflict with the import library of a shared one.
if (CMAKE_HOST_WIN32)
mamba_create_target(mamba-static STATIC mamba_static)
else ()
mamba_create_target(mamba-static STATIC mamba)
add_subdirectory(libmamba)
endif()
find_package(nlohmann_json CONFIG REQUIRED)
target_link_libraries(mamba-static PUBLIC
nlohmann_json::nlohmann_json
Threads::Threads)
list(APPEND mamba_targets mamba-static)
# Python bindings of libmamba
if (BUILD_LIBMAMBAPY)
add_subdirectory(libmambapy)
endif()
if (BUILD_BINDINGS)
find_package(pybind11 REQUIRED)
pybind11_add_module(mamba_api
src/mamba/py_interface.cpp
)
target_link_libraries(mamba_api PUBLIC pybind11::pybind11 mamba-static)
set_property(TARGET mamba_api PROPERTY CXX_STANDARD 17)
install(TARGETS mamba_api
LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/mamba/)
endif()
if (BUILD_EXE)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/micromamba/CMakeLists.txt)
endif()
# Tests
# =====
if (ENABLE_TESTS)
add_subdirectory(test)
endif()
# Installation
# ============
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(MAMBA_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for mambaConfig.cmake")
if (NOT (BUILD_EXE AND STATIC_DEPENDENCIES))
install(TARGETS ${mamba_targets}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY "${MAMBA_INCLUDE_DIR}/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.h")
# Makes the project importable from the build directory
export(EXPORT ${PROJECT_NAME}-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
# Configure 'mambaConfig.cmake' for a build tree
set(MAMBA_CONFIG_CODE "####### Expanded from \@MAMBA_CONFIG_CODE\@ #######\n")
set(MAMBA_CONFIG_CODE "${MAMBA_CONFIG_CODE}set(CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake;\${CMAKE_MODULE_PATH}\")\n")
set(MAMBA_CONFIG_CODE "${MAMBA_CONFIG_CODE}##################################################")
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${PROJECT_BINARY_DIR})
# Configure 'mambaConfig.cmake' for an install tree
set(MAMBA_CONFIG_CODE "")
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${MAMBA_CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${MAMBA_VERSION_MAJOR}.${MAMBA_VERSION_MINOR}.${MAMBA_VERSION_PATCH}
COMPATIBILITY AnyNewerVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${MAMBA_CMAKECONFIG_INSTALL_DIR})
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${MAMBA_CMAKECONFIG_INSTALL_DIR})
# micromamba
if (BUILD_MICROMAMBA)
add_subdirectory(micromamba)
endif()

View File

@ -54,6 +54,7 @@ Now you are ready to install packages with
```bash
mamba install xtensor-r -c conda-forge
```
for example.
### Additional features
@ -98,7 +99,6 @@ $ mamba repoquery whoneeds ipython
With the `--tree` (or `-t`) flag, you can get the same information in a tree.
## micromamba
`micromamba` is a tiny version of the `mamba` package manager.
@ -140,43 +140,7 @@ For more instructions (including OS X) check out https://gist.github.com/wolfv/f
### Development installation
Make sure you install mamba's requirements in your conda environment:
`mamba env update --name <conda_env> --file environment-dev.yml`
If you build mamba in a different environment than base, you must also install conda in
that environment:
`mamba install conda -c conda-forge`
For a local (dev) build, run `pip install -e .`. This will build and install mamba
in the conda environment.
#### cmake based build
You will additionally need to install cmake and cli11 for micromamba:
```bash
mamba install -c conda-forge cli11 cmake
```
For the C++ tests, you need Google Test and Google Mock installed (e.g. `mamba install gtest gmock`).
To build the program using CMake, the following lines need to be used:
```bash
mkdir -p build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DPYTHON_EXECUTABLE=$CONDA_PREFIX/bin/python3 \
-DPYTHON_LIBRARIES=$CONDA_PREFIX/lib/libpython3.7m.so \
-DENABLE_TESTS=ON
cmake --build . -j
```
This would generate the test program `./test/test_mamba` under the `build`
directory which you can execute with `make test`. To generate the executable
`micromamba` also include the CMake option `-DBUILD_EXE=ON` in the above step.
Please refer to the instructions given by the [official documentation](https://mamba.readthedocs.io/en/latest/developer_zone/build_locally.html#).
### Support us

View File

@ -28,129 +28,58 @@ Install dev requirements
.. code::
mamba env update --name <env_name> --file environment-dev.yml
mamba env update --name <env_name> --file ./<project>/environment-dev.yml
.. code::
micromamba install --name <env_name> --file environment-dev.yml
micromamba install --name <env_name> --file ./<project>/environment-dev.yml
If you don't have one, refer to the :ref:`installation<installation>` page.
Pick the correction environment spec file depending on the project you want to build.
``mamba`` relies on ``python setup.py`` installation while others targets rely on ``cmake`` configuration.
If you don't have an existing env, refer to the :ref:`installation<installation>` page.
The different parts of this repository are sub-projects, all relying (totally or partially) on ``cmake`` configuration.
.. note::
All ``cmake`` commands listed below use ``bash`` multi-line syntax.
On Windows, replace ``\`` trailing character with ``^``.
Build ``mamba``
===============
If you build ``mamba`` in a different environment than *base*, you must also install ``conda``
in that environment:
.. code::
mamba install conda -c conda-forge
For a local (dev) build, run in the environment:
.. code::
pip install -e .
This will build and install ``mamba`` in the current environment.
Build ``micromamba``
====================
Dynamically linked
******************
To build ``micromamba``, just activate the ``BUILD_EXE`` flag in ``cmake`` command:
.. code:: bash
mkdir -p build
cd build
cmake .. \
-BUILD_EXE=ON
cmake --build . -j
.. note::
Feel free to use your favorite generator: ``make``, ``ninja``, etc.
.. note::
If you need to install, use to install in your current development environment:
- ``-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX`` [unix]
- ``-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX\\Library`` [win]
| Doing so, you have built the dynamically linked version of ``micromamba``.
| It's well fitted for development but is not the artifact shipped when installing ``micromamba``.
Statically linked
*****************
``micromamba`` is a fully statically linked executable. To build it, you need to install extra requirements:
.. code::
micromamba install --name <env_name> --file environment-static-dev.yml
It will install the development version of dependencies, including static libraries.
Now you can run ``cmake`` with the additional flag ``STATIC_DEPENDENCIES`` turned on:
.. code:: bash
mkdir -p build
cd build
cmake .. \
-DBUILD_EXE=ON \
-DSTATIC_DEPENDENCIES=ON
cmake --build . -j
Tests
*****
You should now be able to run the Python-based test suite:
.. code::
pytest ./test/micromamba
Build ``libmamba``
==================
``libmamba`` build is enabled using ``BUILD_LIBMAMBA`` ``cmake`` option.
Shared library
**************
You need to enable the build of ``libmamba`` shared library using ``BUILD_SHARED`` flag in ``cmake`` command:
Also needs ``BUILD_SHARED`` to be activated:
.. code:: bash
mkdir -p build
cd build
cmake .. \
-DBUILD_LIBMAMBA=ON \
-DBUILD_SHARED=ON
cmake --build . -j
make
Static library
**************
| The static build of ``libmamba`` is enabled by default (``BUILD_STATIC=ON``).
| You can run :
Also needs ``BUILD_STATIC`` to be activated:
.. code:: bash
mkdir -p build
cd build
cmake ..
cmake --build . -j
cmake .. \
-DBUILD_LIBMAMBA=ON \
-DBUILD_STATIC=ON
make
Tests
*****
@ -162,14 +91,14 @@ First, compile the ``gtest``-based C++ test suite:
mkdir -p build
cd build
cmake .. \
-DENABLE_TESTS=ON
cmake --build . -j
-DBUILD_LIBMAMBA_TESTS=ON
make
You should now be able to run:
.. code::
./test/test_mamba
./libmamba/tests/test_libmamba
Alternatively you can use:
@ -178,4 +107,99 @@ Alternatively you can use:
make test
.. note::
The static version of ``libmamba`` is necessary to build the C++ tests, don't disable it!
The static version of ``libmamba`` is necessary to build the C++ tests, it will be automatically turned-on
Build ``libmambapy``
====================
The Python bindings of ``libmamba``, ``libmambapy`` can be built by using the ``BUILD_LIBMAMBAPY`` ``cmake`` option.
.. code:: bash
mkdir -p build
cd build
cmake .. \
-DBUILD_LIBMAMBAPY=ON
make
You'll need to install the target to have the bindings Python sub-module correctly located, then you can use ``pip`` to install that Python package:
.. code:: bash
make install
pip install -e ../libmambapy/ --no-deps
.. note::
The editable mode ``-e`` provided by ``pip`` allows to use the source directory as the Python package instead of copying sources inside the environment
You can then change the code without having to reinstall the package
.. note::
The ``--no-deps`` tells ``pip`` to skip the dependencies installation, since they are already installed (``libmamba`` installed using ``cmake``)
Build ``mamba``
===============
You need to build and install ``libmambapy``, which is a dependency of ``mamba``, then install ``mamba``:
.. code::
pip install -e ./mamba/ --no-deps
Build ``micromamba``
====================
Dynamically linked
******************
To build ``micromamba``, just activate the ``BUILD_MICROMAMBA`` flag in ``cmake`` command:
.. code:: bash
mkdir -p build
cd build
cmake .. \
-BUILD_MICROMAMBA=ON
make
.. note::
If you need to install the executable, use your current development environment:
- ``-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX`` [unix]
- ``-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX\\Library`` [win]
| Doing so, you have built the dynamically linked version of ``micromamba``.
| It's well fitted for development but is not the artifact shipped when installing ``micromamba`` because it still requires the dependencies shared libraries to work.
Statically linked
*****************
``micromamba`` is a fully statically linked executable. To build it, you need to install extra requirements:
.. code::
micromamba install --name <env_name> --file ./micromamba/environment-static-dev.yml
It will install the development version of dependencies, including static libraries.
Now you can run ``cmake`` with the additional flag ``MICROMAMBA_STATIC_LINK`` turned on:
.. code:: bash
mkdir -p build
cd build
cmake .. \
-DBUILD_MICROMAMBA=ON \
-DMICROMAMBA_STATIC_LINK=ON
make
Tests
*****
You should be able to run the Python-based test suite:
.. code::
pytest ./micromamba/tests/

View File

@ -1,32 +0,0 @@
// Copyright (c) 2019, QuantStack and Mamba Contributors
//
// Distributed under the terms of the BSD 3-Clause License.
//
// The full license is in the file LICENSE, distributed with this software.
#ifndef MAMBA_CORE_VERSION_HPP
#define MAMBA_CORE_VERSION_HPP
#include <string>
#define MAMBA_VERSION_MAJOR @MAMBA_VERSION_MAJOR@
#define MAMBA_VERSION_MINOR @MAMBA_VERSION_MINOR@
#define MAMBA_VERSION_PATCH @MAMBA_VERSION_PATCH@
// Binary version
#define MAMBA_BINARY_CURRENT 1
#define MAMBA_BINARY_REVISION 0
#define MAMBA_BINARY_AGE 0
#define MAMBA_VERSION \
(MAMBA_VERSION_MAJOR * 10000 + MAMBA_VERSION_MINOR * 100 + MAMBA_VERSION_PATCH)
#define MAMBA_VERSION_STRING "@MAMBA_VERSION_MAJOR@.@MAMBA_VERSION_MINOR@.@MAMBA_VERSION_PATCH@"
extern const char mamba_version[];
extern int mamba_version_major;
extern int mamba_version_minor;
extern int mamba_version_patch;
std::string version();
#endif

526
libmamba/CHANGELOG.md Normal file
View File

@ -0,0 +1,526 @@
0.17.0 (October 13, 2021)
=========================
API Breaking changes:
The Transaction and the Subdir interface have slightly changed (no more explicit setting of the writable
packages dir is necessary, this value is taken directly from the MultiPackagesCache now)
- improve listing of (RC-) configurable values in `micromamba` #1210 (thanks @adriendelsalle)
- Improve micromamba lockfiles and add many tests #1193 (thanks @adriendelsalle)
- Support multiple package caches in micromamba (thanks @adriendelsalle) #1109
- Order explicit envs in micromamba (also added some text to the docs about libsolv transactions) #1198
- Add `micromamba package` subcommand to extract, create and transmute packages #1187
- Improve micromamba configuration to support multi-stage loading of RC files (thanks @adriendelsalle) #1189 #1190 #1191 #1188
- Add handling of `CONDA_SAFETY_CHECKS` to micromamba #1143 (thanks @isuruf)
- Improve mamba messaging by adding a space #1186 (thanks @wkusnierczyk)
- Add support for `custom_multichannels` #1142
- micromamba: expose setting for `add_pip_as_python_dependency` #1203
- stop displaying banner when running `mamba list` #1184 (thanks @madhur-thandon)
0.16.0 (September 27, 2021)
===========================
- Add a User-Agent header to all requests (mamba/0.16.0) (thanks @shankerwangmiao)
- Add `micromamba env export (--explicit)` to micromamba
- Do not display banner with `mamba list` (thanks @madhur-tandon)
- Use directory of environment.yml as cwd when creating environment (thanks @marscher & @adriendelsalle)
- Improve outputs
- content-trust: Add Python bindings for content-trust API
- content-trust: Load PkgMgr definitions from file
- content-trust: Improve HEAD request fallback handling
- export Transaction.find_python_version to Python
- Continue `shell init` when we can't create the prefix script dir (thanks @maresb)
- Implement support for `fish` shell in `micromamba` (thanks @soraxas)
- Add constraint with pin when updating
- Expose methods for virtual packages to Python (thanks @madhur-tandon)
0.15.3 (August 18, 2021)
========================
- change token regex to work with edge-cases (underscores in user name) (#1122)
- only pin major.minor version of python for update --all (#1101, thanks @mparry!)
- add mamba init to the activate message (#1124, thanks @isuruf)
- hide tokens in logs (#1121)
- add lockfiles for repodata and pkgs download (#1105, thanks @jaimergp)
- log actual SHA256/MD5/file size when failing to avlidate (#1095, thanks @johnhany97)
- Add mamba.bat in front of PATH (#1112, thanks @isuruf)
- Fix mamba not writable cache errors (#1108)
0.15.2 (July 16, 2021)
======================
- micromamba autocomplete now ready for usage (#1091)
- improved file:// urls for windows to properly work (#1090)
0.15.1 (July 15, 2021)
======================
New features:
- add `mamba init` command and add mamba.sh (#1075, thanks @isuruf & #1078)
- add flexible channel priority option in micromamba CLI (#1087)
- improved autocompletion for micromamba (#1079)
Bug fixes:
- improve "file://" URL handling, fix local channel on Windows (#1085)
- fix CONDA_SUBDIR not being used in mamba (#1084)
- pass in channel_alias and custom_channels from conda to mamba (#1081)
0.15.0 (July 9, 2021)
=====================
Big changes:
- improve solutions by inspecting dependency versions as well (libsolv PR:
https://github.com/openSUSE/libsolv/pull/457) @wolfv
- properly implement strict channel priority (libsolv PR:
https://github.com/openSUSE/libsolv/pull/459) @adriendelsalle
+ Note that this changes the meaning of strict and flexible priority as the
previous implementation did not follow conda's semantics. Mamba now has
three modes, just like conda: strict, flexible and disabled. Strict will
completely disregard any packages from lower-priority channels if a
package of the same name exists in a higher priority channel. Flexible
will use packages from lower-priority channels if necessary to fulfill
dependencies or explicitly requested (e.g. by version number). Disabled
will use the highest version number, irregardless of the channel order.
- allow subdir selection as part of the channel: users can now specify an
explicit list of subdirs, for example:
`-c mychannel[linux-static64, linux-64, noarch]`
to pull in repodata and packages from these three subdirs.
Thanks for the contribution, @afranchuk! #1033
New features
- remove orphaned packages such as dependencies of explicitely installed
packages (@adriendelsalle) #1040
- add a diff character before package name in transaction table to improve
readability without coloration (@adriendelsalle) #1040
- add capability to freeze installed packages during `install` operation using
`--freeze-installed` flag (@adriendelsalle) #1048
- Hide tokens and basic http auth secrets in log messages (#1061)
- Parse and use explicit platform specifications (thanks @afranchuk) (#1033)
- add pretty print to repoquery search (thanks @madhur-tandon) (#1018)
- add docs for package resolution
Bug fixes:
- Fix small output issues (#1060)
- More descriptive incorrect download error (thanks @AntoinePrv) #1066
- respect channel specific pins when updating (#1045)
- keep track features in PackageInfo class (#1046)
0.14.1 (June 25, 2021)
======================
New features
- [micromamba] add remove command, to remove keys of vectors (@marimeireles)
#1011
Bug fixes
- [micromamba] fixed in config prepend and append sequence (@adriendelsalle)
#1023
- fix bug when username has @ (@madhur-tandon) #1025
- fix wrong update spec in history (@madhur-tandon) #1028
- [mamba] silent pinned packages using JSON output (@adriendelsalle) #1031
0.14.0 (June 16, 2021)
======================
New features
- [micromamba] add `config set`, `get`, `append` and `prepend`, `remove`
(@marimeireles) #838
- automatically include `pip` in conda dependencies when having pip packages to
install (@madhur-tandon) #973
- add experimental support for artifacts verification (@adriendelsalle)
#954,#955,#956,#963,#965,#970,#972,#978
- [micromamba] shell init will try attempt to enable long paths support on
Windows (@wolfv) #975
- [micromamba] if `menuinst` json files are present, micromamba will create
shortcuts in the start menu on Windows (@wolfv) #975
- Improve python auto-pinning and add --no-py-pin flag to micromamba
(@adriendelsalle) #1010
- [micromamba] Fix constructor invalid repodata_record (@adriendelsalle) #1007
- Refactor log levels for linking steps (@adriendelsalle) #1009
- [micromamba] Use a proper requirements.txt file for pip installations #1008
Bug fixes
- fix double-print int transaction (@JohanMabille) #952
- fix strip function (@wolfv) #974
- [micromamba] expand home directory in `--rc-file` (@adriendelsalle) #979
- [micromamba] add yes and no as additional ways of answering a prompt
(@ibebrett) #989
- fix long paths support on Windows (@adriendelsalle) #994
General improvement
- remove duplicate snippet (@madhur-tandon) #957
- add `trace` log level (@adriendelsalle) #988
Docs
- concepts, user guide, configuration, update installation and build locally
(@adriendelsalle) #953
- advance usage section, linking (@adriendelsalle) #998
- repo, channel, subdir, repodata, tarball (@adriendelsalle) #1004
- artifacts verification (@adriendelsalle) #1000
0.13.1 (May 17, 2021)
=====================
Bug fixes
- [micromamba] pin only minor python version #948
- [micromamba] use openssl certs when not linking statically #949
0.13.0 (May 12, 2021)
=====================
New features
- [mamba & micromamba] aggregated progress bar for package downloading and
extraction (thanks @JohanMabille) #928
Bug fixes
- [micromamba] fixes for micromamba usage in constructor #935
- [micromamba] fixes for the usage of lock files #936
- [micromamba] switched from libsodium to openssl for ed25519 signature
verification #933
Docs
- Mention mambaforge in the README (thanks @s-pike) #932
0.12.3 (May 10, 2021)
=====================
New features
- [libmamba] add free-function to use an existing conda root prefix
(@adriendelsalle) #927
General improvements
- [micromamba] fix a typo in documentation (@cjber) #926
0.12.2 (May 03, 2021)
=====================
New features
- [micromamba] add initial framework for TUF validation (@adriendelsalle) #916
#919
- [micromamba] add channels from specs to download (@wolfv) #918
0.12.1 (Apr 30, 2021)
=====================
New features
- [micromamba] env list subcommand (@wolfv) #913
Bug fixes
- [micromamba] fix multiple shell init with cmd.exe (@adriendelsalle) #915
- [micromamba] fix activate with --stack option (@wolfv) #914
- [libmamba] only try loading ssl certificates when needed (@adriendelsalle)
#910
- [micromamba] remove target_prefix checks when activating (@adriendelsalle)
#909
- [micromamba] allow 'ultra-dry' config checks in final build (@adriendelsalle)
#912
0.12.0 (Apr 26, 2021)
=====================
New features
- [libmamba] add experimental shell autocompletion (@wolfv) #900
- [libmamba] add token handling (@wolfv) #886
- [libmamba] add experimental pip support in spec files (@wolfv) #885
Bug fixes
- [libmamba] ignore failing pyc compilation for noarch packages (@wolfv) #904
#905
- [libmamba] fix string wrapping in error message (@bdice) #902
- [libmamba] fix cache error during remove operation (@adriendelsalle) #901
- [libmamba] add constraint with pinning during update operation (@wolfv) #892
- [libmamba] fix shell activate prefix check (@ashwinvis) #889
- [libmamba] make prefix mandatory for shell init (@adriendelsalle) #896
- [mamba] fix `env update` command (@ScottWales) #891
General improvements
- [libmamba] use lockfile, fix channel not loaded logic (@wolfv) #903
- [libmamba] make root_prefix warnings more selective (@adriendelsalle) #899
- [libmamba] house-keeping in python tests (@adriendelsalle) #898
- [libmamba] modify mamba/micromamba specific guards (@adriendelsalle) #895
- [libmamba] add simple lockfile mechanism (@wolfv) #894
- [libmamba] deactivate ca-certificates search when using offline mode
(@adriendelsalle) #893
0.11.3 (Apr 21, 2021)
====================
- [libmamba] make platform rc configurable #883
- [libmamba] expand user home in target and root prefixes #882
- [libmamba] avoid memory effect between operations on target_prefix #881
- [libmamba] fix unnecessary throwing target_prefix check in `clean` operation
#880
- [micromamba] fix `clean` flags handling #880
- [libmamba] C-API teardown on error #879
0.11.2 (Apr 21, 2021)
====================
- [libmamba] create "base" env only for install operation #875
- [libmamba] remove confirmation prompt of root_prefix in shell init #874
- [libmamba] improve overrides between target_prefix and env_name #873
- [micromamba] fix use of `-p,--prefix` and spec file env name #873
0.11.1 (Apr 20, 2021)
====================
- [libmamba] fix channel_priority computation #872
0.11.0 (Apr 20, 2021)
====================
- [libmamba] add experimental mode that unlock edge features #858
- [micromamba] add `--experimental` umamba flag to enable experimental mode
#858
- [libmamba] improve base env creation #860
- [libmamba] fix computation of weakly canonical target prefix #859
- update libsolv dependency in env-dev.yml file, update documentation (thanks
@Aratz) #843
- [libmamba] handle package cache in secondary locations, fix symlink errors
(thanks wenjuno) #856
- [libmamba] fix CI cURL SSL error on macos with Darwin backend (thanks @wolfv)
#865
- [libmamba] improve error handling in C-API by catching and returning an error
code #862
- [libmamba] handle configuration lifetime (single operation configs) #863
- [libmamba] enable ultra-dry C++ tests #868
- [libmamba] migrate `config` operation implem from `micromamba` to `libmamba`
API #866
- [libmamba] add capapbility to set CLI config from C-API #867
0.10.0 (Apr 16, 2021)
====================
- [micromamba] allow creation of empty env (without specs) #824 #827
- [micromamba] automatically create empy `base` env at new root prefix #836
- [micromamba] add remove all CLI flags `-a,--all` #824
- [micromamba] add dry-run and ultra-dry-run tests to increase coverage and
speed-up CI #813 #845
- [micromamba] allow CLI to override spec file env name (create, install and
update) #816
- [libmamba] split low-level and high-level API #821 #824
- [libmamba] add a C high-level API #826
- [micromamba] support `__linux` virtual package #829
- [micromamba] improve the display of solver problems #822
- [micromamba] improve info sub-command with target prefix status (active, not
found, etc.) #825
- [mamba] Change pybind11 to a build dependency (thanks @maresb) #846
- [micromamba] add shell detection for shell sub-command #839
- [micromamba] expand user in shell prefix sub-command #831
- [micromamba] refactor explicit specs install #824
- [libmamba] improve configuration (refactor API, create a loading sequence)
#840
- [libmamba] support cpp-filesystem breaking changes on Windows fs #849
- [libmamba] add a simple context debugging (thanks @wolf) #820
- [libmamba] improve C++ test suite #830
- fix CI C++ tests (unix/libmamba) and Python tests (win/mamba) wrongly
successful #853
0.9.2 (Apr 1, 2021)
====================
- [micromamba] fix unc url support (thanks @adament)
- [micromamba] add --channel-alias as cli option to micromamba (thanks
@adriendelsalle)
- [micromamba] fix --no-rc and environment yaml files (thanks @adriendelsalle)
- [micromamba] handle spec files in update and install subcommands (thanks
@adriendelsalle)
- add simple context debugging, dry run tests and other test framework
improvements
0.9.1 (Mar 26, 2021)
====================
- [micromamba] fix remove command target_prefix selection
- [micromamba] improve target_prefix fallback for CLI, add tests (thanks
@adriendelsalle)
0.9.0 (Mar 25, 2021)
====================
- [micromamba] use strict channels priority by default
- [micromamba] change config precedence order: API>CLI>ENV>RC
- [micromamba] `config list` sub command optional display of sources, defaults,
short/long descriptions and groups
- [micromamba] prevent crashes when no bashrc or zshrc file found (thanks
@wolfv)
- add support for UNC file:// urls (thanks @adament)
- add support for use_only_tar_bz2 (thanks @tl-hbk @wolfv)
- add pinned specs for env update (thanks @wolfv)
- properly adhere to run_constrains (thanks @wolfv)
0.8.2 (Mar 12, 2021)
====================
- [micromamba] fix setting network options before explicit spec installation
- [micromamba] fix python based tests for windows
0.8.1 (Mar 11, 2021)
====================
- use stoull (instead of stoi) to prevent overflow with long package build
numbers (thanks @pbauwens-kbc)
- [micromamba] fixing OS X certificate search path
- [micromamba] refactor default root prefix, make it configurable from CLI
(thanks @adriendelsalle)
- [micromamba] set ssl backend, use native SSL if possible (thanks
@adriendelsalle)
- [micromamba] sort json transaction, and add UNLINK field
- [micromamba] left align log messages
- [micromamba] libsolv log messages to stderr (thanks @mariusvniekerk)
- [micromamba] better curl error messages
0.8.0 (Mar 5, 2021)
===================
- [micromamba] condarc and mambarc config file reading (and config subcommand)
(thanks @adriendelsalle)
- [micromamba] support for virtual packages (thanks @adriendelsalle)
- [micromamba] set ssl backend, use native SSL if possible
- [micromamba] add python based testing framework for CLI
- [micromamba] refactor CLI and micromamba main file (thanks @adriendelsalle)
- [micromamba] add linking options (--always-copy etc.) (thanks
@adriendelsalle)
- [micromamba] fix multiple prefix replacements in binary files
- [micromamba] fix micromamba clean (thanks @phue)
- [micromamba] change package validation settings to --safety-checks and
--extra-safety-checks
- [micromamba] add update subcommand (thanks @adriendelsalle)
- [micromamba] support pinning packages (including python minor version)
(thanks @adriendelsalle)
- [micromamba] add try/catch to WinReg getStringValue (thanks @SvenAdler)
- [micromamba] add ssl-no-revoke option for more conda-compatibility (thanks
@tl-hbk)
- [micromamba] die when no ssl certificates are found (thanks @wholtz)
- [docs] add explanation for base env install (thanks @ralexx) and rename
changelog to .md (thanks @kevinheavey)
- [micromamba] compare cleaned URLs for cache invalidation
- [micromamba] add regex handling to list command
0.7.14 (Feb 12, 2021)
=====================
- [micromamba] better validation of extracted directories
- [mamba] add additional tests for authentication and simple repodata server
- make LOG_WARN the default log level, and move some logs to INFO
- [micromamba] properly replace long shebangs when linking
- [micromamba] add quote for shell for prefixes with spaces
- [micromamba] add clean functionality
- [micromamba] always make target prefix path absolute
0.7.13 (Feb 4, 2021)
====================
- [micromamba] Immediately exit after printing version (again)
0.7.12 (Feb 3, 2021)
====================
- [micromamba] Improve CTRL+C signal handling behavior and simplify code
- [micromamba] Revert extraction to temporary directory because of invalid
cross-device links on Linux
- [micromamba] Clean up partially extracted archives when CTRL+C interruption
occured
0.7.11 (Feb 2, 2021)
====================
- [micromamba] use wrapped call when compiling noarch Python code, which
properly calls chcp for Windows
- [micromamba] improve checking the pkgs cache
- [mamba] fix authenticated URLs (thanks @wenjuno)
- first extract to temporary directory, then move to final pkgs cache to
prevent corrupted extracted data
0.7.10 (Jan 22, 2021)
====================
- [micromamba] properly fix PATH when linking, prevents missing
vcruntime140.dll
- [mamba] add virtual packages when creating any environment, not just on
update (thanks @cbalioglu)
0.7.9 (Jan 19, 2021)
====================
- [micromamba] fix PATH when linking
0.7.8 (Jan 14, 2021)
====================
- [micromamba] retry on corrupted repodata
- [mamba & micromamba] fix error handling when writing repodata
0.7.6 (Dec 22, 2020)
====================
- [micromamba] more console flushing for std::cout consumers
0.7.6 (Dec 14, 2020)
====================
- [mamba] more arguments for repodata.create_pool
0.7.5 (Dec 10, 2020)
====================
- [micromamba] better error handling for YAML file reading, allows to pass in
`-n` and `-p` from command line
- [mamba & micromamba] ignore case of HTTP headers
- [mamba] fix channel keys are without tokens (thanks @s22chan)
0.7.4 (Dec 5, 2020)
====================
- [micromamba] fix noarch installation for explicit environments
0.7.3 (Nov 20, 2020)
====================
- [micromamba] fix installation of noarch files with long prefixes
- [micromamba] fix activation on windows with whitespaces in root prefix
(thanks @adriendelsalle)
- [micromamba] add `--json` output to micromamba list
0.7.2 (Nov 18, 2020)
====================
- [micromamba] explicit specs installing should be better now
- empty lines are ignored
- network settings are correctly set to make ssl verification work
- New Python repoquery API for mamba
- Fix symlink packing for mamba package creation and transmute
- Do not keep tempfiles around
0.7.1 (Nov 16, 2020)
====================
- Handle LIBARCHIVE_WARN to not error, instead print warning (thanks @obilaniu)
0.7.0 (Nov 12, 2020)
====================
- Improve activation and deactivation logic for micromamba
- Switching `subprocess` implementation to more tested `reproc++`
- Fixing Windows noarch entrypoints generation with micromamba
- Fix pre-/post-link script running with micromamba to use micromamba
activation logic
- Empty environment creation skips all repodata downloading & solving
- Fix micromamba install when environment is activated (thanks @isuruf)
- Micromamba now respects the $CONDA_SUBDIR environment variable (thanks
@mariusvniekerk)
- Fix compile time warning (thanks @obilaniu)
- Fixed wrong CondaValueError import statement in mamba.py (thanks @saraedum)
0.6.5 (Oct 2020)
================
- Fix code signing for Apple Silicon (osx-arm64) @isuruf

327
libmamba/CMakeLists.txt Normal file
View File

@ -0,0 +1,327 @@
# Copyright (c) 2019, QuantStack and Mamba Contributors
#
# Distributed under the terms of the BSD 3-Clause License.
#
# The full license is in the file LICENSE, distributed with this software.
cmake_minimum_required (VERSION 3.2)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
cmake_policy(SET CMP0077 NEW)
project(libmamba)
set(LIBMAMBA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(LIBMAMBA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
# Versionning
# ===========
file(STRINGS "${LIBMAMBA_INCLUDE_DIR}/mamba/version.hpp" libmamba_version_defines
REGEX "#define LIBMAMBA_VERSION_(MAJOR|MINOR|PATCH)")
foreach(ver ${libmamba_version_defines})
if(ver MATCHES "#define LIBMAMBA_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$")
set(LIBMAMBA_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(${PROJECT_NAME}_VERSION
${LIBMAMBA_VERSION_MAJOR}.${LIBMAMBA_VERSION_MINOR}.${LIBMAMBA_VERSION_PATCH})
message(STATUS "Building libmamba v${${PROJECT_NAME}_VERSION}")
# Binary version
# See the following URL for explanations about the binary versionning
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
file(STRINGS "${LIBMAMBA_INCLUDE_DIR}/mamba/version.hpp" libmamba_version_defines
REGEX "#define LIBMAMBA_BINARY_(CURRENT|REVISION|AGE)")
foreach(ver ${libmamba_version_defines})
if(ver MATCHES "#define LIBMAMBA_BINARY_(CURRENT|REVISION|AGE) +([^ ]+)$")
set(LIBMAMBA_BINARY_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(LIBMAMBA_BINARY_VERSION
${LIBMAMBA_BINARY_CURRENT}.${LIBMAMBA_BINARY_REVISION}.${LIBMAMBA_BINARY_AGE})
message(STATUS "libmamba binary version: v${LIBMAMBA_BINARY_VERSION}")
# Build options
# =============
option(BUILD_TESTS "Build libmamba C++ tests" OFF)
option(BUILD_SHARED "Build shared libmamba library" OFF)
option(BUILD_STATIC "Build static libmamba library" OFF)
option(MICROMAMBA_STATIC_LINK "" OFF)
# Source files
# ============
set(LIBMAMBA_SOURCES
${LIBMAMBA_SOURCE_DIR}/version.cpp
# Core API (low-level)
${LIBMAMBA_SOURCE_DIR}/core/activation.cpp
${LIBMAMBA_SOURCE_DIR}/core/channel.cpp
${LIBMAMBA_SOURCE_DIR}/core/context.cpp
${LIBMAMBA_SOURCE_DIR}/core/environments_manager.cpp
${LIBMAMBA_SOURCE_DIR}/core/fetch.cpp
${LIBMAMBA_SOURCE_DIR}/core/transaction_context.cpp
${LIBMAMBA_SOURCE_DIR}/core/link.cpp
${LIBMAMBA_SOURCE_DIR}/core/history.cpp
${LIBMAMBA_SOURCE_DIR}/core/match_spec.cpp
${LIBMAMBA_SOURCE_DIR}/core/menuinst.cpp
${LIBMAMBA_SOURCE_DIR}/core/url.cpp
${LIBMAMBA_SOURCE_DIR}/core/output.cpp
${LIBMAMBA_SOURCE_DIR}/core/package_handling.cpp
${LIBMAMBA_SOURCE_DIR}/core/package_cache.cpp
${LIBMAMBA_SOURCE_DIR}/core/pool.cpp
${LIBMAMBA_SOURCE_DIR}/core/prefix_data.cpp
${LIBMAMBA_SOURCE_DIR}/core/progress_bar.cpp
${LIBMAMBA_SOURCE_DIR}/core/pinning.cpp
${LIBMAMBA_SOURCE_DIR}/core/package_info.cpp
${LIBMAMBA_SOURCE_DIR}/core/package_paths.cpp
${LIBMAMBA_SOURCE_DIR}/core/query.cpp
${LIBMAMBA_SOURCE_DIR}/core/repo.cpp
${LIBMAMBA_SOURCE_DIR}/core/shell_init.cpp
${LIBMAMBA_SOURCE_DIR}/core/solver.cpp
${LIBMAMBA_SOURCE_DIR}/core/subdirdata.cpp
${LIBMAMBA_SOURCE_DIR}/core/thread_utils.cpp
${LIBMAMBA_SOURCE_DIR}/core/transaction.cpp
${LIBMAMBA_SOURCE_DIR}/core/util.cpp
${LIBMAMBA_SOURCE_DIR}/core/util_os.cpp
${LIBMAMBA_SOURCE_DIR}/core/validate.cpp
${LIBMAMBA_SOURCE_DIR}/core/virtual_packages.cpp
# API (high-level)
${LIBMAMBA_SOURCE_DIR}/api/c_api.cpp
${LIBMAMBA_SOURCE_DIR}/api/clean.cpp
${LIBMAMBA_SOURCE_DIR}/api/config.cpp
${LIBMAMBA_SOURCE_DIR}/api/configuration.cpp
${LIBMAMBA_SOURCE_DIR}/api/create.cpp
${LIBMAMBA_SOURCE_DIR}/api/info.cpp
${LIBMAMBA_SOURCE_DIR}/api/install.cpp
${LIBMAMBA_SOURCE_DIR}/api/list.cpp
${LIBMAMBA_SOURCE_DIR}/api/remove.cpp
${LIBMAMBA_SOURCE_DIR}/api/shell.cpp
${LIBMAMBA_SOURCE_DIR}/api/update.cpp
)
set(LIBMAMBA_THIRD_PARTIES
${LIBMAMBA_SOURCE_DIR}/thirdparty/WinReg.hpp
)
set(LIBMAMBA_HEADERS
${LIBMAMBA_INCLUDE_DIR}/mamba/version.hpp
# Core API (low-level)
${LIBMAMBA_INCLUDE_DIR}/mamba/core/activation.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/channel.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/context.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/environment.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/environments_manager.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/fetch.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/fsutil.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/graph_util.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/history.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/link.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/mamba_fs.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/match_spec.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/menuinst.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/output.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_cache.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_handling.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_info.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_paths.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/pool.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/prefix_data.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/progress_bar.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/pinning.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/query.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/repo.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/shell_init.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/solver.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/subdirdata.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/thread_utils.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/transaction.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/transaction_context.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/url.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/util.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/util_os.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/validate.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/core/virtual_packages.hpp
# API (high-level)
${LIBMAMBA_INCLUDE_DIR}/mamba/api/c_api.h
${LIBMAMBA_INCLUDE_DIR}/mamba/api/clean.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/config.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/configuration.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/constants.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/create.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/info.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/install.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/list.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/remove.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/shell.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/api/update.hpp
)
# Targets and link
# ================
macro(libmamba_create_target target_name linkage output_name)
string(TOUPPER "${linkage}" linkage_upper)
if (NOT ${linkage_upper} MATCHES "^(SHARED|STATIC)$")
message(FATAL_ERROR "Invalid library linkage: ${linkage}")
endif ()
# Output
# ======
add_library(${target_name} ${linkage_upper} ${LIBMAMBA_SOURCES} ${LIBMAMBA_HEADERS} ${LIBMAMBA_THIRD_PARTIES})
if (NOT MICROMAMBA_STATIC_LINK)
find_library(LIBSOLV_LIBRARIES NAMES solv)
find_library(LIBSOLVEXT_LIBRARIES NAMES solvext)
find_package(CURL REQUIRED)
find_package(LibArchive REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(yaml-cpp CONFIG REQUIRED)
find_package(reproc++ CONFIG REQUIRED)
set(LIBMAMBA_LIBRARIES_DEPS
${LIBSOLV_LIBRARIES}
${LIBSOLVEXT_LIBRARIES}
${LibArchive_LIBRARIES}
${CURL_LIBRARIES}
${OPENSSL_LIBRARIES}
${YAML_CPP_LIBRARIES}
reproc++
)
target_link_libraries(${target_name} PUBLIC
${LIBMAMBA_LIBRARIES_DEPS}
${MAMBA_FORCE_DYNAMIC_LIBS})
endif()
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD 17)
target_include_directories(
${target_name}
PUBLIC
$<BUILD_INTERFACE:${LIBMAMBA_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>
)
# TODO: package WinReg header
target_include_directories(
${target_name}
PRIVATE ${LIBMAMBA_SOURCE_DIR}
)
if (UNIX)
math(EXPR LIBMAMBA_BINARY_COMPATIBLE "${LIBMAMBA_BINARY_CURRENT} - ${LIBMAMBA_BINARY_AGE}")
set_target_properties(
${target_name}
PROPERTIES
PUBLIC_HEADER "${LIBMAMBA_HEADERS}"
COMPILE_DEFINITIONS "LIBMAMBA_EXPORTS"
PREFIX ""
VERSION "${LIBMAMBA_BINARY_COMPATIBLE}.${LIBMAMBA_BINARY_REVISION}.${LIBMAMBA_BINARY_AGE}"
SOVERSION ${LIBMAMBA_BINARY_COMPATIBLE}
OUTPUT_NAME "${output_name}"
)
else()
set_target_properties(
${target_name}
PROPERTIES
PUBLIC_HEADER "${LIBMAMBA_HEADERS}"
COMPILE_DEFINITIONS "LIBMAMBA_EXPORTS"
PREFIX ""
VERSION ${LIBMAMBA_BINARY_VERSION}
SOVERSION ${LIBMAMBA_BINARY_CURRENT}
OUTPUT_NAME "${output_name}"
)
target_compile_definitions(${target_name} PUBLIC GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
endif()
endmacro()
set(libmamba_targets "")
if (BUILD_SHARED)
message(STATUS "Building shared library libmamba")
libmamba_create_target(libmamba SHARED libmamba)
list(APPEND libmamba_targets libmamba)
endif ()
if (BUILD_STATIC)
message(STATUS "Building static library libmamba")
# On Windows, a static library should use a different output name
# to avoid the conflict with the import library of a shared one.
if (CMAKE_HOST_WIN32)
libmamba_create_target(libmamba-static STATIC libmamba_static)
else ()
libmamba_create_target(libmamba-static STATIC libmamba)
endif ()
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Threads REQUIRED)
target_link_libraries(libmamba-static PUBLIC
nlohmann_json::nlohmann_json
Threads::Threads)
list(APPEND libmamba_targets libmamba-static)
endif ()
if (NOT (BUILD_SHARED OR BUILD_STATIC))
message(FATAL_ERROR "Select at least a build variant (shared/static) for libmamba")
endif ()
# Tests
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
# Installation
# ============
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(LIBMAMBA_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for libmambaConfig.cmake")
install(TARGETS ${libmamba_targets}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY "${LIBMAMBA_INCLUDE_DIR}/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.h")
# Makes the project importable from the build directory
export(EXPORT ${PROJECT_NAME}-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
# Configure 'mambaConfig.cmake' for a build tree
set(MAMBA_CONFIG_CODE "####### Expanded from \@MAMBA_CONFIG_CODE\@ #######\n")
set(MAMBA_CONFIG_CODE "${MAMBA_CONFIG_CODE}set(CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake;\${CMAKE_MODULE_PATH}\")\n")
set(MAMBA_CONFIG_CODE "${MAMBA_CONFIG_CODE}##################################################")
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${PROJECT_BINARY_DIR})
# Configure 'mambaConfig.cmake' for an install tree
set(MAMBA_CONFIG_CODE "")
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${LIBMAMBA_CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${MAMBA_VERSION_MAJOR}.${MAMBA_VERSION_MINOR}.${MAMBA_VERSION_PATCH}
COMPATIBILITY AnyNewerVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${LIBMAMBA_CMAKECONFIG_INSTALL_DIR})
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${LIBMAMBA_CMAKECONFIG_INSTALL_DIR})

11
libmamba/LICENSE Normal file
View File

@ -0,0 +1,11 @@
Copyright 2019 QuantStack and the Mamba contributors.
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.

View File

@ -0,0 +1,20 @@
name: mamba-dev
channels:
- conda-forge
dependencies:
- cxx-compiler
- cmake
- ninja
- ccache
- nlohmann_json
- libsolv >=0.7.18
- libarchive
- libsodium
- libcurl 7.76.1 *_0
- gtest
- gmock
- cpp-filesystem >=1.5.8
- reproc-cpp
- yaml-cpp
- termcolor-cpp
- cli11

View File

@ -0,0 +1,33 @@
// Copyright (c) 2019, QuantStack and Mamba Contributors
//
// Distributed under the terms of the BSD 3-Clause License.
//
// The full license is in the file LICENSE, distributed with this software.
#ifndef LIBMAMBA_VERSION_HPP
#define LIBMAMBA_VERSION_HPP
#include <array>
#include <string>
#define LIBMAMBA_VERSION_MAJOR 0
#define LIBMAMBA_VERSION_MINOR 17
#define LIBMAMBA_VERSION_PATCH 0
// Binary version
#define LIBMAMBA_BINARY_CURRENT 1
#define LIBMAMBA_BINARY_REVISION 0
#define LIBMAMBA_BINARY_AGE 0
#define LIBMAMBA_VERSION \
(LIBMAMBA_VERSION_MAJOR * 10000 + LIBMAMBA_VERSION_MINOR * 100 + LIBMAMBA_VERSION_PATCH)
#define LIBMAMBA_VERSION_STRING "0.17.0"
namespace mamba
{
std::string version();
std::array<int, 3> version_arr();
}
#endif

View File

@ -0,0 +1,42 @@
############################################################################
# Copyright (c) 2019, QuantStack and Mamba Contributors #
# #
# Distributed under the terms of the BSD 3-Clause License. #
# #
# The full license is in the file LICENSE, distributed with this software. #
############################################################################
# libmamba cmake module
# This module sets the following variables in your project::
#
# libmamba_FOUND - true if libmamba found on the system
# libmamba_INCLUDE_DIRS - the directory containing libmamba headers
# libmamba_LIBRARY - the library for dynamic linking
# libmamba_STATIC_LIBRARY - the library for static linking
@PACKAGE_INIT@
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR};${CMAKE_MODULE_PATH}")
@LIBMAMBA_CONFIG_CODE@
include(CMakeFindDependencyMacro)
find_dependency(nlohmann_json)
find_dependency(Threads)
if(NOT TARGET libmamba AND NOT TARGET libmamba-static)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
if (TARGET libmamba AND TARGET libmamba-static)
get_target_property(@PROJECT_NAME@_INCLUDE_DIR libmamba INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(@PROJECT_NAME@_LIBRARY libmamba LOCATION)
get_target_property(@PROJECT_NAME@_STATIC_LIBRARY libmamba-static LOCATION)
elseif (TARGET libmamba)
get_target_property(@PROJECT_NAME@_INCLUDE_DIR libmamba INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(@PROJECT_NAME@_LIBRARY libmamba LOCATION)
elseif (TARGET libmamba-static)
get_target_property(@PROJECT_NAME@_INCLUDE_DIR libmamba-static INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(@PROJECT_NAME@_STATIC_LIBRARY libmamba-static LOCATION)
set(@PROJECT_NAME@_LIBRARY ${@PROJECT_NAME@_STATIC_LIBRARY})
endif ()
endif()

View File

@ -20,7 +20,7 @@
#include <algorithm>
#include <stdexcept>
#include "thirdparty/termcolor.hpp"
#include "termcolor/termcolor.hpp"
namespace mamba

View File

@ -4,6 +4,8 @@
//
// The full license is in the file LICENSE, distributed with this software.
#include "mamba/version.hpp"
#include "mamba/api/configuration.hpp"
#include "mamba/api/info.hpp"
#include "mamba/api/install.hpp"
@ -11,7 +13,6 @@
#include "mamba/core/context.hpp"
#include "mamba/core/environment.hpp"
#include "mamba/core/util.hpp"
#include "mamba/core/version.hpp"
#include "mamba/core/virtual_packages.hpp"
@ -32,11 +33,6 @@ namespace mamba
config.operation_teardown();
}
std::string version()
{
return mamba_version;
}
std::string banner()
{
auto& ctx = Context::instance();

View File

@ -23,7 +23,7 @@
#include "mamba/core/util.hpp"
#include "mamba/core/virtual_packages.hpp"
#include "thirdparty/termcolor.hpp"
#include "termcolor/termcolor.hpp"
namespace mamba
{

View File

@ -12,7 +12,7 @@
#include "mamba/core/thread_utils.hpp"
#include "mamba/core/util.hpp"
#include "thirdparty/termcolor.hpp"
#include "termcolor/termcolor.hpp"
namespace mamba
{

View File

@ -4,16 +4,17 @@
//
// The full license is in the file LICENSE, distributed with this software.
#include <string_view>
#include <thread>
#include <regex>
#include "mamba/version.hpp"
#include "mamba/core/fetch.hpp"
#include "mamba/core/context.hpp"
#include "mamba/core/thread_utils.hpp"
#include "mamba/core/util.hpp"
#include "mamba/core/url.hpp"
#include "mamba/core/version.hpp"
#include <string_view>
#include <thread>
#include <regex>
namespace mamba
{
@ -30,7 +31,7 @@ namespace mamba
return;
}
#ifdef UMAMBA_STATIC
#ifdef MICROMAMBA_STATIC_LINK
CURLsslset sslset_res;
const curl_ssl_backend** available_backends;
@ -190,7 +191,7 @@ namespace mamba
}
else if (ssl_verify == "<system>")
{
#ifdef UMAMBA_STATIC
#ifdef MICROMAMBA_STATIC_LINK
curl_easy_setopt(handle, CURLOPT_CAINFO, nullptr);
#endif
}
@ -229,7 +230,7 @@ namespace mamba
}
static std::string user_agent
= std::string("User-Agent: mamba/" MAMBA_VERSION_STRING " ") + curl_version();
= std::string("User-Agent: mamba/" LIBMAMBA_VERSION_STRING " ") + curl_version();
m_headers = curl_slist_append(m_headers, user_agent.c_str());
curl_easy_setopt(m_handle, CURLOPT_HTTPHEADER, m_headers);

View File

@ -9,7 +9,7 @@
#include <tuple>
#include <vector>
#include "thirdparty/termcolor.hpp"
#include "termcolor/termcolor.hpp"
#include <reproc++/run.hpp>
#include "mamba/core/environment.hpp"

View File

@ -15,7 +15,7 @@
#include "mamba/core/url.hpp"
#include "mamba/core/util.hpp"
#include "thirdparty/termcolor.hpp"
#include "termcolor/termcolor.hpp"
#include <algorithm>
#include <cstdlib>

Some files were not shown because too many files have changed in this diff Show More