Skip to content

Commit a6f5e17

Browse files
authored
Merge branch 'main' into 17054-custom-name
2 parents d529d3f + fa46c0a commit a6f5e17

File tree

5 files changed

+23
-53
lines changed

5 files changed

+23
-53
lines changed

Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,19 @@ dev: install-dep
6666
## dist : create a module package for distribution
6767
dist: dist/${MODULE}-$(VERSION).tar.gz
6868

69-
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
69+
check-python3:
70+
# Check that the default python version is python 3
71+
python --version 2>&1 | grep "Python 3"
72+
73+
dist/${MODULE}-$(VERSION).tar.gz: check-python3 $(SOURCES)
7074
python setup.py sdist bdist_wheel
7175

7276
## docs : make the docs
7377
docs: FORCE
7478
cd docs && $(MAKE) html
7579

7680
## clean : clean up all temporary / machine-generated files
77-
clean: FORCE
81+
clean: check-python3 FORCE
7882
rm -f ${MODILE}/*.pyc tests/*.pyc
7983
python setup.py clean --all || true
8084
rm -Rf .coverage
@@ -142,11 +146,11 @@ diff-cover.html: coverage.xml
142146
diff-cover --compare-branch=main $^ --html-report $@
143147

144148
## test : run the ${MODULE} test suite
145-
test: $(PYSOURCES)
149+
test: check-python3 $(PYSOURCES)
146150
python -m pytest ${PYTEST_EXTRA}
147151

148152
## testcov : run the ${MODULE} test suite and collect coverage
149-
testcov: $(PYSOURCES)
153+
testcov: check-python3 $(PYSOURCES)
150154
python -m pytest --cov --cov-config=.coveragerc --cov-report= ${PYTEST_EXTRA}
151155

152156
sloccount.sc: $(PYSOURCES) Makefile
@@ -162,10 +166,10 @@ list-author-emails:
162166

163167
mypy3: mypy
164168
mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
165-
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
169+
if ! test -f $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
166170
then \
167171
rm -Rf typeshed/ruamel/yaml ; \
168-
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
172+
ln -s $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
169173
typeshed/ruamel/ ; \
170174
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
171175
MYPYPATH=$$MYPYPATH:typeshed mypy $^
@@ -181,7 +185,7 @@ shellcheck: FORCE
181185
pyupgrade: $(PYSOURCES)
182186
pyupgrade --exit-zero-even-if-changed --py36-plus $^
183187

184-
release-test: FORCE
188+
release-test: check-python3 FORCE
185189
git diff-index --quiet HEAD -- || ( echo You have uncommited changes, please commit them and try again; false )
186190
./release-test.sh
187191

cwltool/process.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -357,28 +357,19 @@ def _relocate(src: str, dst: str) -> None:
357357
return
358358

359359
# If the source is not contained in source_directories we're not allowed to delete it
360-
real_src = fs_access.realpath(src)
360+
src = fs_access.realpath(src)
361361
src_can_deleted = any(
362-
os.path.commonprefix([p, real_src]) == p for p in source_directories
362+
os.path.commonprefix([p, src]) == p for p in source_directories
363363
)
364364

365365
_action = "move" if action == "move" and src_can_deleted else "copy"
366366

367367
if _action == "move":
368368
_logger.debug("Moving %s to %s", src, dst)
369-
if fs_access.isdir(src):
370-
if fs_access.isdir(dst):
371-
if len(fs_access.listdir(dst)) > 0:
372-
# merge directories
373-
for dir_entry in scandir(src):
374-
_relocate(
375-
dir_entry.path, fs_access.join(dst, dir_entry.name)
376-
)
377-
else:
378-
os.rmdir(dst)
379-
shutil.move(src, dst)
380-
else:
381-
shutil.move(src, dst)
369+
if fs_access.isdir(src) and fs_access.isdir(dst):
370+
# merge directories
371+
for dir_entry in scandir(src):
372+
_relocate(dir_entry.path, fs_access.join(dst, dir_entry.name))
382373
else:
383374
shutil.move(src, dst)
384375

release-test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
test_prefix=""
2020
run_tests() {
2121
local mod_loc
22-
mod_loc=$(pip show ${package} |
22+
mod_loc=$(pip show ${package} |
2323
grep ^Location | awk '{print $2}')/${module}
2424
"${test_prefix}"bin/py.test "--ignore=${mod_loc}/schemas/" \
2525
--pyargs -x ${module} -n auto --dist=loadfile
@@ -42,6 +42,7 @@ then
4242
&& pip install --force-reinstall -U pip==${pipver} \
4343
&& pip install setuptools==${setuptoolsver} wheel
4444
pip install -rtest-requirements.txt
45+
pip install -e .
4546
make test
4647
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
4748
mkdir testenv1/not-${module}

tests/symlinks.cwl

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/test_relocate.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
from .util import get_data, needs_docker
88

9-
from io import StringIO
9+
if sys.version_info[0] < 3:
10+
from StringIO import StringIO
11+
else:
12+
from io import StringIO
1013

1114

1215
@needs_docker
@@ -15,21 +18,6 @@ def test_for_910() -> None:
1518
assert main([get_data("tests/wf/910.cwl")]) == 0
1619

1720

18-
def test_symlinks_with_absolute_paths(tmp_path: Path) -> None:
19-
"""Confirm that absolute paths in Directory types don't cause problems."""
20-
assert (
21-
main(
22-
[
23-
"--debug",
24-
f"--outdir={tmp_path}/result",
25-
f"--tmpdir-prefix={tmp_path}/tmp",
26-
get_data("tests/symlinks.cwl"),
27-
]
28-
)
29-
== 0
30-
)
31-
32-
3321
@needs_docker
3422
def test_for_conflict_file_names(tmp_path: Path) -> None:
3523
stream = StringIO()

0 commit comments

Comments
 (0)