Skip to content

Commit

Permalink
Check that the python packages versions match the conda version
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Oct 20, 2021
1 parent dbc0c46 commit 073ec99
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions recipes/gym-ignition/build_gym_ignition.sh
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Fix Python package version
$PYTHON ${RECIPE_DIR}/sed.py -f setup.cfg --pre "name=gym-ignition" --post "name=gym-ignition\nversion=$PKG_VERSION"
$PYTHON ${RECIPE_DIR}/sed.py -f pyproject.toml --pre "[tool.setuptools_scm]" --post ""
$PYTHON ${RECIPE_DIR}/sed.py -f pyproject.toml --pre 'local_scheme = "dirty-tag"' --post ""

pip install --no-build-isolation --no-deps .
7 changes: 6 additions & 1 deletion recipes/gym-ignition/build_scenariopy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
python \
# Fix Python package version
$PYTHON ${RECIPE_DIR}/sed.py -f setup.cfg --pre "name=scenario" --post "name=scenario\nversion=$PKG_VERSION"
$PYTHON ${RECIPE_DIR}/sed.py -f pyproject.toml --pre "[tool.setuptools_scm]" --post ""
$PYTHON ${RECIPE_DIR}/sed.py -f pyproject.toml --pre 'local_scheme = "dirty-tag"' --post ""

$PYTHON \
-m build \
--wheel \
--outdir dist \
Expand Down
2 changes: 2 additions & 0 deletions recipes/gym-ignition/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ outputs:
- scenario
commands:
- pip check
- test $(pip list | grep scenario | tr -s " " | grep $PKG_VERSION | wc -l) -eq 1 # [unix]
requires:
- pip

Expand Down Expand Up @@ -139,6 +140,7 @@ outputs:
- gym_ignition
commands:
# - pip check (needs idyntree installed with pip during conda build)
- test $(pip list | grep gym-ignition | tr -s " " | grep $PKG_VERSION | wc -l) -eq 1 # [unix]
- sed -i "s|def test_angular_acceleration|def _test_angular_acceleration|g" tests/test_scenario/test_link_velocities.py
- pytest
requires:
Expand Down
17 changes: 17 additions & 0 deletions recipes/gym-ignition/sed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
import argparse
import fileinput

if __name__ == "__main__":

parser = argparse.ArgumentParser()
parser.add_argument("-f", "--file", type=str)
parser.add_argument("--pre", type=str)
parser.add_argument("--post", type=str)

args = parser.parse_args()

# This context redirects stdout to the file changing it in place
with fileinput.FileInput(args.file, inplace=True, backup='.bak') as file:
for line in file:
print(line.replace(args.pre, args.post), end='')

0 comments on commit 073ec99

Please sign in to comment.