Skip to content

Commit abd07b5

Browse files
committed
simplify dot generator
1 parent 0a41b90 commit abd07b5

File tree

1 file changed

+2
-175
lines changed

1 file changed

+2
-175
lines changed

vinca/generate_dot.py

Lines changed: 2 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -7,141 +7,14 @@
77
import argparse
88
from distutils.dir_util import copy_tree
99
import yaml
10-
11-
12-
class folded_unicode(str):
13-
pass
14-
15-
16-
class literal_unicode(str):
17-
pass
18-
19-
20-
def folded_unicode_representer(dumper, data):
21-
return dumper.represent_scalar("tag:yaml.org,2002:str", data, style=">")
22-
23-
24-
def literal_unicode_representer(dumper, data):
25-
return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|")
26-
27-
28-
yaml.add_representer(folded_unicode, folded_unicode_representer)
29-
yaml.add_representer(literal_unicode, literal_unicode_representer)
30-
31-
32-
azure_linux_script = literal_unicode("""\
33-
export CI=azure
34-
export GIT_BRANCH=$BUILD_SOURCEBRANCHNAME
35-
export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME})
36-
.scripts/run_docker_build.sh""")
37-
38-
azure_osx_script = literal_unicode(r"""\
39-
export CI=azure
40-
export GIT_BRANCH=$BUILD_SOURCEBRANCHNAME
41-
export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME})
42-
.scripts/build_osx.sh""")
43-
44-
azure_osx_arm64_script = literal_unicode(r"""\
45-
export CI=azure
46-
export GIT_BRANCH=$BUILD_SOURCEBRANCHNAME
47-
export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME})
48-
.scripts/build_osx_arm64.sh""")
49-
50-
azure_win_preconfig_script = literal_unicode("""\
51-
set "CI=azure"
52-
call %CONDA%\\condabin\\conda_hook.bat
53-
call %CONDA%\\condabin\\conda.bat activate base
54-
55-
:: 2 cores available on Appveyor workers: https://www.appveyor.com/docs/build-environment/#build-vm-configurations
56-
:: CPU_COUNT is passed through conda build: https://github.com/conda/conda-build/pull/1149
57-
set CPU_COUNT=2
58-
59-
set PYTHONUNBUFFERED=1
60-
61-
conda config --set show_channel_urls true
62-
conda config --set auto_update_conda false
63-
conda config --set add_pip_as_python_dependency false
64-
65-
call setup_x64
66-
67-
:: Set the conda-build working directory to a smaller path
68-
if "%CONDA_BLD_PATH%" == "" (
69-
set "CONDA_BLD_PATH=C:\\bld\\"
70-
)
71-
72-
:: Remove some directories from PATH
73-
set "PATH=%PATH:C:\\ProgramData\\Chocolatey\\bin;=%"
74-
set "PATH=%PATH:C:\\Program Files (x86)\\sbt\\bin;=%"
75-
set "PATH=%PATH:C:\\Rust\\.cargo\\bin;=%"
76-
set "PATH=%PATH:C:\\Program Files\\Git\\usr\\bin;=%"
77-
set "PATH=%PATH:C:\\Program Files\\Git\\cmd;=%"
78-
set "PATH=%PATH:C:\\Program Files\\Git\\mingw64\\bin;=%"
79-
set "PATH=%PATH:C:\\Program Files (x86)\\Subversion\\bin;=%"
80-
set "PATH=%PATH:C:\\Program Files\\CMake\\bin;=%"
81-
set "PATH=%PATH:C:\\Program Files\\OpenSSL\\bin;=%"
82-
set "PATH=%PATH:C:\\Strawberry\\c\\bin;=%"
83-
set "PATH=%PATH:C:\\Strawberry\\perl\\bin;=%"
84-
set "PATH=%PATH:C:\\Strawberry\\perl\\site\\bin;=%"
85-
set "PATH=%PATH:c:\\tools\\php;=%"
86-
87-
:: On azure, there are libcrypto*.dll & libssl*.dll under
88-
:: C:\\Windows\\System32, which should not be there (no vendor dlls in windows folder).
89-
:: They would be found before the openssl libs of the conda environment, so we delete them.
90-
if defined CI (
91-
DEL C:\\Windows\\System32\\libcrypto-1_1-x64.dll || (Echo Ignoring failure to delete C:\\Windows\\System32\\libcrypto-1_1-x64.dll)
92-
DEL C:\\Windows\\System32\\libssl-1_1-x64.dll || (Echo Ignoring failure to delete C:\\Windows\\System32\\libssl-1_1-x64.dll)
93-
)
94-
95-
:: Make paths like C:\\hostedtoolcache\\windows\\Ruby\\2.5.7\\x64\\bin garbage
96-
set "PATH=%PATH:ostedtoolcache=%"
97-
98-
mkdir "%CONDA%\\etc\\conda\\activate.d"
99-
100-
echo set "CONDA_BLD_PATH=%CONDA_BLD_PATH%" > "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
101-
echo set "CPU_COUNT=%CPU_COUNT%" >> "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
102-
echo set "PYTHONUNBUFFERED=%PYTHONUNBUFFERED%" >> "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
103-
echo set "PATH=%PATH%" >> "%CONDA%\\etc\\conda\\activate.d\\conda-forge-ci-setup-activate.bat"
104-
105-
conda info
106-
conda config --show-sources
107-
conda list --show-channel-urls
108-
""")
109-
110-
azure_win_script = literal_unicode("""\
111-
setlocal EnableExtensions EnableDelayedExpansion
112-
call %CONDA%\\condabin\\conda_hook.bat
113-
call %CONDA%\\condabin\\conda.bat activate base
114-
115-
set "FEEDSTOCK_ROOT=%cd%"
116-
117-
call conda config --append channels defaults
118-
call conda config --add channels conda-forge
119-
call conda config --add channels robostack
120-
call conda config --set channel_priority strict
121-
122-
:: conda remove --force m2-git
123-
124-
C:\\Miniconda\\python.exe -m pip install git+https://github.com/mamba-org/boa.git@master
125-
if errorlevel 1 exit 1
126-
127-
for %%X in (%CURRENT_RECIPES%) do (
128-
echo "BUILDING RECIPE %%X"
129-
cd %FEEDSTOCK_ROOT%\\recipes\\%%X\\
130-
copy %FEEDSTOCK_ROOT%\\conda_build_config.yaml .\\conda_build_config.yaml
131-
boa build .
132-
if errorlevel 1 exit 1
133-
)
134-
135-
anaconda -t %ANACONDA_API_TOKEN% upload "C:\\bld\\win-64\\*.tar.bz2" --force
136-
if errorlevel 1 exit 1
137-
""")
10+
import requests
13811

13912
parsed_args = None
14013

14114

14215
def parse_command_line(argv):
14316
parser = argparse.ArgumentParser(
144-
description="Conda recipe Azure pipeline generator for ROS packages"
17+
description="Conda recipe Dot graphic generator for ROS packages"
14518
)
14619

14720
default_dir = "./recipes"
@@ -173,52 +46,6 @@ def parse_command_line(argv):
17346
parsed_args = arguments
17447
return arguments
17548

176-
177-
def normalize_name(s):
178-
s = s.replace("-", "_")
179-
return re.sub("[^a-zA-Z0-9_]+", "", s)
180-
181-
182-
def batch_stages(stages, max_batch_size=5):
183-
with open("vinca.yaml", "r") as vinca_yaml:
184-
vinca_conf = yaml.safe_load(vinca_yaml)
185-
186-
# this reduces the number of individual builds to try to save some time
187-
stage_lengths = [len(s) for s in stages]
188-
merged_stages = []
189-
curr_stage = []
190-
build_individually = vinca_conf.get("build_in_own_azure_stage", [])
191-
192-
def chunks(lst, n):
193-
"""Yield successive n-sized chunks from lst."""
194-
for i in range(0, len(lst), n):
195-
yield lst[i:i + n]
196-
i = 0
197-
while i < len(stages):
198-
for build_individually_pkg in build_individually:
199-
if build_individually_pkg in stages[i]:
200-
merged_stages.append([[build_individually_pkg]])
201-
stages[i].remove(build_individually_pkg)
202-
203-
if stage_lengths[i] < max_batch_size and len(curr_stage) + stage_lengths[i] < max_batch_size:
204-
# merge with previous stage
205-
curr_stage += stages[i]
206-
else:
207-
if len(curr_stage):
208-
merged_stages.append([curr_stage])
209-
curr_stage = []
210-
if stage_lengths[i] < max_batch_size:
211-
curr_stage += stages[i]
212-
else:
213-
# split this stage into multiple
214-
merged_stages.append(list(chunks(stages[i], max_batch_size)))
215-
i += 1
216-
if len(curr_stage):
217-
merged_stages.append([curr_stage])
218-
return merged_stages
219-
220-
import requests
221-
22249
def get_skip_existing(vinca_conf, platform):
22350
fn = vinca_conf.get("skip_existing")
22451
repodatas = []

0 commit comments

Comments
 (0)