Skip to content

Commit f6bc66d

Browse files
authored
Merge pull request #98 from baszalmstra/about-and-pixi
licenses, urls and pixi
2 parents a0ba3a8 + 3a1fb5c commit f6bc66d

16 files changed

Lines changed: 2992 additions & 106 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,6 @@ dmypy.json
140140

141141
# Generated examples
142142
# examples/
143+
# pixi environments
144+
.pixi/*
145+
!.pixi/config.toml

pixi.lock

Lines changed: 2134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
name = "vinca"
4+
platforms = ["win-64", "linux-64", "osx-arm64", "osx-64"]
5+
version = "0.1.0"
6+
7+
[tasks]
8+
# Testing
9+
test = "pytest vinca/"
10+
11+
# Code quality
12+
format = "black --safe --quiet ."
13+
lint = "flake8 vinca/"
14+
15+
[dependencies]
16+
python = ">=3.14.0,<3.15"
17+
18+
# Core dependencies
19+
catkin_pkg = ">=0.4.16"
20+
"ruamel.yaml" = ">=0.16.6,<0.18.0"
21+
rosdistro = ">=0.8.0"
22+
empy = ">=3.3.4,<4.0.0"
23+
requests = ">=2.24.0"
24+
networkx = ">=2.5"
25+
rich = ">=10"
26+
jinja2 = ">=3.0.0"
27+
license-expression = ">=30.0.0"
28+
29+
# Development dependencies
30+
pytest = "*"
31+
black = "*"
32+
flake8 = "*"
33+
34+
[pypi-dependencies]
35+
vinca = { path = ".", editable = true}

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ install_requires =
3333
networkx >=2.5
3434
rich >=10
3535
jinja2 >=3.0.0
36+
license-expression >=30.0.0
3637
packages = find:
3738
zip_safe = false
3839

vinca/distro.py

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77

88

99
class Distro(object):
10-
def __init__(self, distro_name, python_version=None, snapshot=None, additional_packages_snapshot=None):
10+
def __init__(
11+
self,
12+
distro_name,
13+
python_version=None,
14+
snapshot=None,
15+
additional_packages_snapshot=None,
16+
):
1117
index = get_index(get_index_url())
1218
self._distro = get_cached_distribution(index, distro_name)
1319
self.distro_name = distro_name
@@ -49,20 +55,30 @@ def get_depends(self, pkg, ignore_pkgs=None):
4955
return dependencies
5056

5157
# if pkg comes from additional_packages_snapshot, extract from its package.xml
52-
if self.additional_packages_snapshot and pkg in self.additional_packages_snapshot:
58+
if (
59+
self.additional_packages_snapshot
60+
and pkg in self.additional_packages_snapshot
61+
):
5362
pkg_info = self.additional_packages_snapshot[pkg]
5463
xml_str = self.get_package_xml_for_additional_package(pkg_info)
5564
# parse XML
5665
import xml.etree.ElementTree as ET
66+
5767
root = ET.fromstring(xml_str)
5868
# collect direct dependencies tags from package.xml
5969
dep_tags = [
60-
'depend', 'build_depend', 'buildtool_depend', 'buildtool_export_depend',
61-
'exec_depend', 'run_depend', 'test_depend', 'build_export_depend'
70+
"depend",
71+
"build_depend",
72+
"buildtool_depend",
73+
"buildtool_export_depend",
74+
"exec_depend",
75+
"run_depend",
76+
"test_depend",
77+
"build_export_depend",
6278
]
6379
direct = set()
6480
for tag in dep_tags:
65-
for elem in root.findall(f'.//{tag}'):
81+
for elem in root.findall(f".//{tag}"):
6682
if elem.text:
6783
name = elem.text.strip()
6884
direct.add(name)
@@ -111,18 +127,26 @@ def get_released_repo(self, pkg_name):
111127
pkg = self._distro.release_packages[pkg_name]
112128
repo = self._distro.repositories[pkg.repository_name].release_repository
113129
release_tag = get_release_tag(repo, pkg_name)
114-
return repo.url, release_tag, 'tag'
130+
return repo.url, release_tag, "tag"
115131

116132
def check_package(self, pkg_name):
117133
# If the package is in the additional_packages_snapshot, it is always considered valid
118134
# even if it is not in the released packages, as it is an additional
119135
# package specified in rosdistro_additional_recipes.yaml
120-
if self.additional_packages_snapshot and pkg_name in self.additional_packages_snapshot:
136+
if (
137+
self.additional_packages_snapshot
138+
and pkg_name in self.additional_packages_snapshot
139+
):
121140
return True
122141
# the .replace('_', '-') is needed for packages like 'hpp-fcl' that have hypen and not underscore
123142
# in the rosdistro metadata
124-
if pkg_name in self._distro.release_packages or pkg_name.replace('_', '-') in self._distro.release_packages:
125-
return self.snapshot is None or (pkg_name in self.snapshot or pkg_name.replace('_', '-') in self.snapshot)
143+
if (
144+
pkg_name in self._distro.release_packages
145+
or pkg_name.replace("_", "-") in self._distro.release_packages
146+
):
147+
return self.snapshot is None or (
148+
pkg_name in self.snapshot or pkg_name.replace("_", "-") in self.snapshot
149+
)
126150
elif pkg_name in self.build_packages:
127151
return True
128152
else:
@@ -137,7 +161,10 @@ def get_version(self, pkg_name):
137161
return repo.version.split("-")[0]
138162

139163
def get_release_package_xml(self, pkg_name):
140-
if self.additional_packages_snapshot and pkg_name in self.additional_packages_snapshot:
164+
if (
165+
self.additional_packages_snapshot
166+
and pkg_name in self.additional_packages_snapshot
167+
):
141168
pkg_info = self.additional_packages_snapshot[pkg_name]
142169
return self.get_package_xml_for_additional_package(pkg_info)
143170
return self._distro.get_release_package_xml(pkg_name)
@@ -171,6 +198,6 @@ def get_package_xml_for_additional_package(self, pkg_info):
171198
raw_url = f"https://raw.githubusercontent.com/{owner_repo}/{ref}/{additional_folder}{xml_name}"
172199
try:
173200
with urllib.request.urlopen(raw_url) as resp:
174-
return resp.read().decode('utf-8')
201+
return resp.read().decode("utf-8")
175202
except Exception as e:
176203
raise RuntimeError(f"Failed to fetch package.xml from {raw_url}: {e}")

vinca/generate_azure.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,12 @@ def get_full_tree():
413413
config.selected_platform = get_conda_subdir()
414414

415415
python_version = temp_vinca_conf.get("python_version", None)
416-
distro = Distro(temp_vinca_conf["ros_distro"], python_version, temp_vinca_conf["_snapshot"], temp_vinca_conf["_additional_packages_snapshot"])
416+
distro = Distro(
417+
temp_vinca_conf["ros_distro"],
418+
python_version,
419+
temp_vinca_conf["_snapshot"],
420+
temp_vinca_conf["_additional_packages_snapshot"],
421+
)
417422

418423
all_packages = get_selected_packages(distro, temp_vinca_conf)
419424
temp_vinca_conf["_selected_pkgs"] = all_packages

vinca/generate_gha.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def build_osx_pipeline(
327327
azure_template=None,
328328
script=azure_unix_script,
329329
target="osx-64",
330-
pipeline_name="build_osx_64"
330+
pipeline_name="build_osx_64",
331331
):
332332
build_unix_pipeline(
333333
stages,
@@ -337,7 +337,7 @@ def build_osx_pipeline(
337337
runs_on=vm_imagename,
338338
outfile=outfile,
339339
target=target,
340-
pipeline_name=pipeline_name
340+
pipeline_name=pipeline_name,
341341
)
342342

343343

@@ -428,7 +428,12 @@ def get_full_tree():
428428
config.selected_platform = get_conda_subdir()
429429

430430
python_version = temp_vinca_conf.get("python_version", None)
431-
distro = Distro(temp_vinca_conf["ros_distro"], python_version, temp_vinca_conf["_snapshot"], temp_vinca_conf["_additional_packages_snapshot"])
431+
distro = Distro(
432+
temp_vinca_conf["ros_distro"],
433+
python_version,
434+
temp_vinca_conf["_snapshot"],
435+
temp_vinca_conf["_additional_packages_snapshot"],
436+
)
432437

433438
all_packages = get_selected_packages(distro, temp_vinca_conf)
434439
temp_vinca_conf["_selected_pkgs"] = all_packages
@@ -562,7 +567,7 @@ def main():
562567
outfile="osx_arm64.yml",
563568
script=azure_unix_script,
564569
target=platform,
565-
pipeline_name="build_osx_arm64"
570+
pipeline_name="build_osx_arm64",
566571
)
567572

568573
if args.platform == "linux-aarch64":
@@ -573,7 +578,7 @@ def main():
573578
runs_on="ubuntu-24.04-arm",
574579
outfile="linux_aarch64.yml",
575580
target=platform,
576-
pipeline_name="build_linux_aarch64"
581+
pipeline_name="build_linux_aarch64",
577582
)
578583

579584
# windows

0 commit comments

Comments
 (0)