Skip to content

Commit 325a59b

Browse files
committed
automatically get distro
1 parent abd07b5 commit 325a59b

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

vinca/migrate.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
import networkx as nx
77
import subprocess
88
import shutil
9+
from vinca.main import read_vinca_yaml
10+
import ruamel.yaml
11+
912

1013
from vinca.distro import Distro
1114

12-
packages_to_migrate = ["libopencv"]
13-
distro_version = "noetic"
14-
ros_prefix = f"ros-{distro_version}"
15+
distro_version = None
16+
ros_prefix = None
1517

16-
arches = ["linux-64", "linux-aarch64", "win-64", "osx-64", "osx-arm64"]
18+
# arches = ["linux-64", "linux-aarch64", "win-64", "osx-64", "osx-arm64"]
19+
# arch_to_fname = {
20+
# "linux-64": "linux",
21+
# "linux-aarch64": "linux_aarch_64",
22+
# "win-64": "win",
23+
# "osx-64": "osx",
24+
# "osx-arm64": "osx_arm64"
25+
# }
1726

1827
def to_ros_name(distro, pkg_name):
1928
shortname = pkg_name[len(ros_prefix) + 1:]
@@ -26,6 +35,15 @@ def to_ros_name(distro, pkg_name):
2635

2736
def create_migration_instructions(arch, packages_to_migrate, trigger_branch):
2837
url = f"https://conda.anaconda.org/robostack/{arch}/repodata.json"
38+
39+
yaml = ruamel.yaml.YAML()
40+
with open("vinca.yaml", "r") as fi:
41+
vinca_conf = yaml.load(fi)
42+
43+
global distro_version, ros_prefix
44+
distro_version = vinca_conf['ros_distro']
45+
ros_prefix = f"ros-{distro_version}"
46+
2947
print("URL: ", url)
3048
# return
3149
repodata = requests.get(url).json()
@@ -46,9 +64,6 @@ def create_migration_instructions(arch, packages_to_migrate, trigger_branch):
4664
# print(f"need to migrate {pkey}")
4765
to_migrate.add(pname)
4866

49-
# print(to_migrate)
50-
# print(ros_pkgs)
51-
5267
latest = {}
5368
for pkg in ros_pkgs:
5469
current = current_version = None
@@ -70,9 +85,7 @@ def create_migration_instructions(arch, packages_to_migrate, trigger_branch):
7085
current = pkey
7186
latest[pkg] = current
7287

73-
# print(latest)
74-
75-
# now we can build the graph ...
88+
# now we can build the graph ...
7689

7790
G = nx.DiGraph()
7891
for pkg, pkgkey in latest.items():
@@ -98,12 +111,6 @@ def create_migration_instructions(arch, packages_to_migrate, trigger_branch):
98111
ros_names.append(to_ros_name(distro, pkg))
99112
print("Final names: ", ros_names)
100113

101-
from vinca.main import read_vinca_yaml
102-
import ruamel.yaml
103-
yaml = ruamel.yaml.YAML()
104-
with open("vinca.yaml", "r") as fi:
105-
vinca_conf = yaml.load(fi)
106-
107114
vinca_conf["packages_select_by_deps"] = ros_names
108115
vinca_conf["skip_all_deps"] = True
109116
vinca_conf["is_migration"] = True

0 commit comments

Comments
 (0)