Skip to content

Commit

Permalink
Merge pull request #66 from RoboStack/rattler-build-humble
Browse files Browse the repository at this point in the history
Migrate to rattler-build and add fixes from early 2025 rebuild of ros-noetic, ros-humble and ros-jazzy
  • Loading branch information
Tobias-Fischer authored Jan 10, 2025
2 parents 0e6ff6d + 1b61041 commit aa102b2
Show file tree
Hide file tree
Showing 19 changed files with 413 additions and 300 deletions.
66 changes: 0 additions & 66 deletions .drone.yml

This file was deleted.

30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 24.3.0
hooks:
- id: black
args: [--safe, --quiet]
- repo: https://github.com/asottile/blacken-docs
rev: v1.7.0
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.10b0]
additional_dependencies: [black]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: ^examples/
Expand All @@ -21,14 +21,14 @@ repos:
# hooks:
# - id: isort
# exclude: tests/data
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
exclude: tests/data
language_version: python3
additional_dependencies:
- flake8-typing-imports==1.9.0
- flake8-builtins==1.5.3
- flake8-bugbear==20.1.4
# - flake8-isort==3.0.1
# - repo: https://github.com/PyCQA/flake8
# rev: 7.0.0
# hooks:
# - id: flake8
# exclude: tests/data
# language_version: python3
# additional_dependencies:
# - flake8-typing-imports==1.9.0
# - flake8-builtins==1.5.3
# - flake8-bugbear==20.1.4
# # - flake8-isort==3.0.1
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ console_scripts =
vinca-gha = vinca.generate_gha:main
vinca-azure = vinca.generate_azure:main
vinca-migrate = vinca.migrate:main
vinca-snapshot = vinca.snapshot:main

[flake8]
import-order-style = google
2 changes: 1 addition & 1 deletion vinca/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.3"
__version__ = "0.0.4"
2 changes: 1 addition & 1 deletion vinca/azure_templates/linux.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export CI=azure
export GIT_BRANCH=$BUILD_SOURCEBRANCHNAME
export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME})
.scripts/run_docker_build.sh
.scripts/build_linux.sh
18 changes: 1 addition & 17 deletions vinca/azure_templates/win_preconfig.bat
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
set "CI=azure"
call activate base
set "CI=true"

:: 4 cores available on GHA: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
:: CPU_COUNT is passed through conda build: https://github.com/conda/conda-build/pull/1149
set CPU_COUNT=4

set PYTHONUNBUFFERED=1

conda config --set show_channel_urls true
conda config --set auto_update_conda false
conda config --set add_pip_as_python_dependency false

call setup_x64

:: Set the conda-build working directory to a smaller path
Expand All @@ -28,14 +23,3 @@ if defined CI (

:: Make paths like C:\\hostedtoolcache\\windows\\Ruby\\2.5.7\\x64\\bin garbage
set "PATH=%PATH:ostedtoolcache=%"

mkdir "%CONDA%\\etc\\conda\\activate.d"

echo set "CONDA_BLD_PATH=%CONDA_BLD_PATH%" > "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
echo set "CPU_COUNT=%CPU_COUNT%" >> "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
echo set "PYTHONUNBUFFERED=%PYTHONUNBUFFERED%" >> "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
echo set "PATH=%PATH%" >> "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"

conda info
conda config --show-sources
conda list --show-channel-urls
17 changes: 15 additions & 2 deletions vinca/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@


class Distro(object):
def __init__(self, distro_name, python_version=None):
def __init__(self, distro_name, python_version=None, snapshot=None):
index = get_index(get_index_url())
self._distro = get_cached_distribution(index, distro_name)
self.distro_name = distro_name
self.snapshot = snapshot
# set up ROS environments
if python_version is None:
python_version = index.distributions[distro_name]["python_version"]
Expand Down Expand Up @@ -60,20 +61,29 @@ def get_depends(self, pkg, ignore_pkgs=None):
return dependencies

def get_released_repo(self, pkg_name):
if self.snapshot and pkg_name in self.snapshot:
return (
self.snapshot[pkg_name].get("url", None),
self.snapshot[pkg_name].get("tag", None),
)

pkg = self._distro.release_packages[pkg_name]
repo = self._distro.repositories[pkg.repository_name].release_repository
release_tag = get_release_tag(repo, pkg_name)
return repo.url, release_tag

def check_package(self, pkg_name):
if pkg_name in self._distro.release_packages:
return True
return self.snapshot is None or pkg_name in self.snapshot
elif pkg_name in self.build_packages:
return True
else:
return False

def get_version(self, pkg_name):
if self.snapshot and pkg_name in self.snapshot:
return self.snapshot[pkg_name].get("version", None)

pkg = self._distro.release_packages[pkg_name]
repo = self._distro.repositories[pkg.repository_name].release_repository
return repo.version.split("-")[0]
Expand All @@ -86,3 +96,6 @@ def check_ros1(self):

def get_python_version(self):
return self._python_version

def get_package_names(self):
return self._distro.release_packages.keys()
4 changes: 3 additions & 1 deletion vinca/generate_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ def main():

if args.platform == "osx-64":
build_osx_pipeline(
stages, args.trigger_branch, script=azure_osx_script,
stages,
args.trigger_branch,
script=azure_osx_script,
)

if args.platform == "osx-arm64":
Expand Down
30 changes: 11 additions & 19 deletions vinca/generate_gha.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def parse_command_line(argv):
action="store_true",
help="search for additional_recipes folder?",
)

parser.add_argument(
"-b",
"--batch_size",
Expand Down Expand Up @@ -198,7 +198,9 @@ def add_additional_recipes(args):
print("Checking if ", name, version, bnumber, " exists")
skip = False
for repo in repodatas:
for _, pkg in repo.get("packages", {}).items():
repo_pkgs = repo.get("packages", {})
repo_pkgs.update(repo.get("packages.conda", {}))
for _, pkg in repo_pkgs.items():
if (
pkg["name"] == name
and pkg["version"] == version
Expand Down Expand Up @@ -263,8 +265,6 @@ def build_linux_pipeline(
if docker_image is None:
docker_image = "condaforge/linux-anvil-cos7-x86_64"

jobs = []
job_names = []
prev_batch_keys = []

for i, s in enumerate(stages):
Expand Down Expand Up @@ -319,8 +319,6 @@ def build_osx_pipeline(
if azure_template is None:
azure_template = blurb

jobs = []
job_names = []
prev_batch_keys = []
for i, s in enumerate(stages):
stage_name = f"stage_{i}"
Expand Down Expand Up @@ -394,21 +392,13 @@ def build_win_pipeline(stages, trigger_branch, outfile="win.yml", azure_template
"steps": [
{"name": "Checkout code", "uses": "actions/checkout@v4"},
{
"uses": "conda-incubator/setup-miniconda@v3",
"name": "Setup pixi",
"uses": "prefix-dev/[email protected]",
"with": {
"channels": "conda-forge",
"miniforge-variant": "Mambaforge",
"miniforge-version": "latest",
"use-mamba": "true",
"channel-priority": "true",
"python-version": "3.11",
"activate-environment": "test",
"pixi-version": "v0.39.4",
"cache": "true",
},
},
{
"run": "mamba install -c conda-forge -n base --yes --quiet conda-build pip mamba ruamel.yaml anaconda-client boa",
"name": "Install conda-build, boa and activate environment",
},
{
"uses": "egor-tensin/cleanup-path@v4",
"with": {
Expand Down Expand Up @@ -571,7 +561,9 @@ def main():

if args.platform == "osx-64":
build_osx_pipeline(
stages, args.trigger_branch, script=azure_osx_script,
stages,
args.trigger_branch,
script=azure_osx_script,
)

if args.platform == "osx-arm64":
Expand Down
Loading

0 comments on commit aa102b2

Please sign in to comment.