Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Pixi
uses: prefix-dev/setup-pixi@28eb668aafebd9dede9d97c4ba1cd9989a4d0004 # v0.9.2
with:
pixi-version: latest
cache: true

- name: Check formatting
run: pixi run fmt-check

- name: Run linter
run: pixi run lint-check

- name: Run tests
run: pixi run test
17 changes: 17 additions & 0 deletions .github/workflows/enforce-sha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
push:
branches: [ main, master ]
pull_request:

name: Security

permissions: read-all

jobs:
ensure-pinned-actions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@9e9574ef04ea69da568d6249bd69539ccc704e74 # v4
223 changes: 65 additions & 158 deletions pixi.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ version = "0.1.0"
test = "pytest vinca/"

# Code quality
format = "black --safe --quiet ."
lint = "flake8 vinca/"
fmt = "ruff format ."
fmt-check = "ruff format --check ."
lint = "ruff check --fix ."
lint-check = "ruff check ."

[dependencies]
python = ">=3.14.0,<3.15"
Expand All @@ -28,8 +30,7 @@ license-expression = ">=30.0.0"

# Development dependencies
pytest = "*"
black = "*"
flake8 = "*"
ruff = "*"

[pypi-dependencies]
vinca = { path = ".", editable = true}
12 changes: 12 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
line-length = 88
target-version = "py37"

[lint]
# Ignore rules that were excluded in .flake8:
# D104: Missing docstring in public package
# E501: Line too long (handled by line-length setting)
ignore = ["D104", "D100", "E501"]

[lint.extend-per-file-ignores]
# Exclude tests/data/* from all checks
"tests/data/*" = ["ALL"]
1 change: 0 additions & 1 deletion vinca/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def get_depends(self, pkg, ignore_pkgs=None):

def get_released_repo(self, pkg_name):
if self.snapshot and pkg_name in self.snapshot:

# In the case of snapshot, for rosdistro_additional_recipes
# we also support a 'rev' field, so depending on what is available
# we return either the tag or the rev, and the third argument is either 'rev' or 'tag'
Expand Down
1 change: 0 additions & 1 deletion vinca/generate_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ def get_full_tree():


def main():

args = parse_command_line(sys.argv)

full_tree = get_full_tree()
Expand Down
2 changes: 0 additions & 2 deletions vinca/generate_gha.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ def build_win_pipeline(stages, trigger_branch, outfile="win.yml", azure_template
with open(".scripts/build_win.bat", "r") as fi:
script = lu(fi.read())

jobs = []
job_names = []
prev_batch_keys = []
for i, s in enumerate(stages):
stage_name = f"stage_{i}"
Expand Down
4 changes: 1 addition & 3 deletions vinca/license_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ def convert_to_spdx_license(
# Split by comma and process each part
# Filter out empty strings from malformed input
# (trailing/double commas)
parts = [
part.strip() for part in lic_str.split(",") if part.strip()
]
parts = [part.strip() for part in lic_str.split(",") if part.strip()]
sub_licenses = []
seen_sub = set()
for part in parts:
Expand Down
127 changes: 14 additions & 113 deletions vinca/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def read_vinca_yaml(filepath):


def read_snapshot(vinca_conf):
if not "rosdistro_snapshot" in vinca_conf:
if "rosdistro_snapshot" not in vinca_conf:
return None, None

yaml = ruamel.yaml.YAML()
Expand Down Expand Up @@ -395,17 +395,17 @@ def generate_output(pkg_shortname, vinca_conf, distro, version, all_pkgs=None):
# Dummy recipes do not actually build anything, so we set the script to empty
output["build"]["script"] = ""
elif pkg.get_build_type() in ["cmake", "catkin"]:
output["build"][
"script"
] = "${{ '$RECIPE_DIR/build_catkin.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_catkin.bat' }}"
output["build"]["script"] = (
"${{ '$RECIPE_DIR/build_catkin.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_catkin.bat' }}"
)
elif pkg.get_build_type() in ["ament_cmake"]:
output["build"][
"script"
] = "${{ '$RECIPE_DIR/build_ament_cmake.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_ament_cmake.bat' }}"
output["build"]["script"] = (
"${{ '$RECIPE_DIR/build_ament_cmake.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_ament_cmake.bat' }}"
)
elif pkg.get_build_type() in ["ament_python"]:
output["build"][
"script"
] = "${{ '$RECIPE_DIR/build_ament_python.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_ament_python.bat' }}"
output["build"]["script"] = (
"${{ '$RECIPE_DIR/build_ament_python.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_ament_python.bat' }}"
)
resolved_setuptools = resolve_pkgname("python-setuptools", vinca_conf, distro)
output["requirements"]["host"].extend(resolved_setuptools)
else:
Expand Down Expand Up @@ -474,10 +474,6 @@ def generate_output(pkg_shortname, vinca_conf, distro, version, all_pkgs=None):
)

for dep in build_deps:
if dep in ["REQUIRE_OPENGL", "REQUIRE_GL"]:
output["requirements"]["host"].append(dep)
continue

resolved_dep = resolve_pkgname(dep, vinca_conf, distro)
if not resolved_dep:
unsatisfied_deps.add(dep)
Expand All @@ -492,10 +488,6 @@ def generate_output(pkg_shortname, vinca_conf, distro, version, all_pkgs=None):
run_deps += gdeps

for dep in run_deps:
if dep in ["REQUIRE_OPENGL", "REQUIRE_GL"]:
output["requirements"]["host"].append(dep)
continue

resolved_dep = resolve_pkgname(dep, vinca_conf, distro, is_rundep=True)
if not resolved_dep:
unsatisfied_deps.add(dep)
Expand Down Expand Up @@ -589,49 +581,6 @@ def sortkey(k):
{"if": "build_platform == target_platform", "then": [pkg_move_to_build]}
]

# fix up OPENGL support for Unix
if (
"REQUIRE_OPENGL" in output["requirements"]["run"]
or "REQUIRE_OPENGL" in output["requirements"]["host"]
):
# add requirements for opengl
while "REQUIRE_OPENGL" in output["requirements"]["run"]:
output["requirements"]["run"].remove("REQUIRE_OPENGL")
while "REQUIRE_OPENGL" in output["requirements"]["host"]:
output["requirements"]["host"].remove("REQUIRE_OPENGL")

output["requirements"]["host"] += [
{
"if": "linux",
"then": ["libgl-devel", "libopengl-devel"],
}
]

output["requirements"]["host"] += [
{"if": "unix", "then": ["xorg-libx11", "xorg-libxext"]},
]
output["requirements"]["run"] += [
{"if": "unix", "then": ["xorg-libx11", "xorg-libxext"]},
]

# fix up GL support for Unix
if (
"REQUIRE_GL" in output["requirements"]["run"]
or "REQUIRE_GL" in output["requirements"]["host"]
):
# add requirements for gl
while "REQUIRE_GL" in output["requirements"]["run"]:
output["requirements"]["run"].remove("REQUIRE_GL")
while "REQUIRE_GL" in output["requirements"]["host"]:
output["requirements"]["host"].remove("REQUIRE_GL")

output["requirements"]["host"] += [
{
"if": "linux",
"then": ["libgl-devel"],
}
]

# remove duplicates
for dep_type in ["build", "host", "run"]:
tmp_nonduplicate = []
Expand Down Expand Up @@ -797,6 +746,7 @@ def generate_source_version(distro, vinca_conf):
entry["git"] = url
entry[ref_type] = ref
pkg_names = resolve_pkgname(pkg_shortname, vinca_conf, distro)
version = distro.get_version(pkg_shortname)
if vinca_conf.get("trigger_new_versions"):
if (
not pkg_names
Expand Down Expand Up @@ -866,7 +816,6 @@ def get_selected_packages(distro, vinca_conf):
)
selected_packages = selected_packages.union(additional_packages)
elif vinca_conf["packages_select_by_deps"]:

if (
"packages_skip_by_deps" in vinca_conf
and vinca_conf["packages_skip_by_deps"] is not None
Expand Down Expand Up @@ -1140,51 +1089,9 @@ def parse_package(pkg, distro, vinca_conf, path):
)

if pkg.get_build_type() in ["cmake", "catkin"]:
recipe["build"][
"script"
] = "${{ '$RECIPE_DIR/build_catkin.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_catkin.bat' }}"

# fix up OPENGL support for Unix
if (
"REQUIRE_OPENGL" in recipe["requirements"]["run"]
or "REQUIRE_OPENGL" in recipe["requirements"]["host"]
):
# add requirements for opengl
while "REQUIRE_OPENGL" in recipe["requirements"]["run"]:
recipe["requirements"]["run"].remove("REQUIRE_OPENGL")
while "REQUIRE_OPENGL" in recipe["requirements"]["host"]:
recipe["requirements"]["host"].remove("REQUIRE_OPENGL")

recipe["requirements"]["host"] += [
{
"if": "linux",
"then": ["libgl-devel", "libopengl-devel"],
}
]
recipe["requirements"]["host"] += [
{"if": "unix", "then": ["xorg-libx11", "xorg-libxext"]},
]
recipe["requirements"]["run"] += [
{"if": "unix", "then": ["xorg-libx11", "xorg-libxext"]},
]

# fix up GL support for Unix
if (
"REQUIRE_GL" in recipe["requirements"]["run"]
or "REQUIRE_GL" in recipe["requirements"]["host"]
):
# add requirements for gl
while "REQUIRE_GL" in recipe["requirements"]["run"]:
recipe["requirements"]["run"].remove("REQUIRE_GL")
while "REQUIRE_GL" in recipe["requirements"]["host"]:
recipe["requirements"]["host"].remove("REQUIRE_GL")

recipe["requirements"]["host"] += [
{
"if": "linux",
"then": ["libgl-devel"],
}
]
recipe["build"]["script"] = (
"${{ '$RECIPE_DIR/build_catkin.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_catkin.bat' }}"
)

return recipe

Expand All @@ -1197,8 +1104,6 @@ def main():
base_dir = os.path.abspath(arguments.dir)
vinca_yaml = os.path.join(base_dir, "vinca.yaml")
vinca_conf = read_vinca_yaml(vinca_yaml)
snapshot = vinca_conf.get("snapshot", None)
additional_packages_snapshot = vinca_conf.get("_additional_packages_snapshot", None)

if arguments.trigger_new_versions:
vinca_conf["trigger_new_versions"] = True
Expand Down Expand Up @@ -1283,10 +1188,6 @@ def main():
if "://" in fn:
selected_bn = vinca_conf.get("build_number", 0)

explicitly_selected_pkgs = [
f"ros-{distro}-{pkg.replace('_', '-')}"
for pkg in ensure_list(vinca_conf["packages_select_by_deps"])
]
all_pkgs = repodata.get("packages", {})
all_pkgs.update(repodata.get("packages.conda", {}))
for _, pkg in all_pkgs.items():
Expand Down