mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
py27 compat fixes
This commit is contained in:
parent
2017a773b6
commit
00fdabed32
7 changed files with 43 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -31,6 +31,7 @@ public/
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.ipynb_checkpoints/
|
.ipynb_checkpoints/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
compat_test/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ unit:
|
||||||
- make lint
|
- make lint
|
||||||
- make mypy
|
- make mypy
|
||||||
- make test
|
- make test
|
||||||
|
- make test_compat
|
||||||
coverage: '/^(TOTAL|src).*?(\d+\%)$/'
|
coverage: '/^(TOTAL|src).*?(\d+\%)$/'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
|
|
|
||||||
|
|
@ -59,5 +59,7 @@ RUN conda clean --all --yes && \
|
||||||
|
|
||||||
FROM registry.gitlab.com/mbarkhau/bootstrapit/root
|
FROM registry.gitlab.com/mbarkhau/bootstrapit/root
|
||||||
|
|
||||||
|
RUN apt-get install --yes mercurial;
|
||||||
|
|
||||||
COPY --from=builder /opt/conda/ /opt/conda/
|
COPY --from=builder /opt/conda/ /opt/conda/
|
||||||
COPY --from=builder /vendor/ /vendor
|
COPY --from=builder /vendor/ /vendor
|
||||||
|
|
|
||||||
4
makefile
4
makefile
|
|
@ -323,7 +323,7 @@ pylint:
|
||||||
|
|
||||||
## Run pytest unit and integration tests
|
## Run pytest unit and integration tests
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: $(COMPAT_TEST_FILES)
|
||||||
@rm -rf ".pytest_cache";
|
@rm -rf ".pytest_cache";
|
||||||
@rm -rf "src/__pycache__";
|
@rm -rf "src/__pycache__";
|
||||||
@rm -rf "test/__pycache__";
|
@rm -rf "test/__pycache__";
|
||||||
|
|
@ -346,7 +346,7 @@ test:
|
||||||
for i in $${!env_paths[@]}; do \
|
for i in $${!env_paths[@]}; do \
|
||||||
env_py=$${env_paths[i]}/bin/python; \
|
env_py=$${env_paths[i]}/bin/python; \
|
||||||
$${env_py} -m pip install --upgrade build/test_wheel/*.whl; \
|
$${env_py} -m pip install --upgrade build/test_wheel/*.whl; \
|
||||||
ENV=$${ENV-dev} $${env_py} -m pytest test/; \
|
ENV=$${ENV-dev} $${env_py} -m pytest --verbose compat_test/; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
@rm -rf ".pytest_cache";
|
@rm -rf ".pytest_cache";
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,30 @@
|
||||||
serve:
|
serve:
|
||||||
echo "Not Implemented"
|
echo "Not Implemented"
|
||||||
|
|
||||||
|
|
||||||
|
COMPAT_TEST_FILES = $(shell ls -1 test/*.py | awk '{ printf " compat_"$$0 }')
|
||||||
|
|
||||||
|
compat_test/%.py: test/%.py
|
||||||
|
@mkdir -p compat_test/;
|
||||||
|
$(DEV_ENV)/bin/lib3to6 $< > $@.tmp;
|
||||||
|
mv $@.tmp $@;
|
||||||
|
|
||||||
|
|
||||||
|
## Run pytest integration tests
|
||||||
|
.PHONY: test_compat
|
||||||
|
test_compat: $(COMPAT_TEST_FILES)
|
||||||
|
rm -rf compat_test/fixtures;
|
||||||
|
mkdir -p compat_test/fixtures;
|
||||||
|
cp -R test/fixtures compat_test/
|
||||||
|
|
||||||
|
# install the package and run the test suite against it.
|
||||||
|
mkdir -p build/test_wheel;
|
||||||
|
$(DEV_ENV_PY) setup.py bdist_wheel --dist-dir build/test_wheel;
|
||||||
|
|
||||||
|
IFS=' ' read -r -a env_paths <<< "$(CONDA_ENV_PATHS)"; \
|
||||||
|
for i in $${!env_paths[@]}; do \
|
||||||
|
env_py=$${env_paths[i]}/bin/python; \
|
||||||
|
$${env_py} -m pip install --upgrade build/test_wheel/*.whl; \
|
||||||
|
PYTHONPATH="" ENV=$${ENV-dev} \
|
||||||
|
$${env_py} -m pytest --verbose compat_test/; \
|
||||||
|
done;
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,4 @@ pathlib2
|
||||||
typing
|
typing
|
||||||
click
|
click
|
||||||
toml
|
toml
|
||||||
|
six
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import toml
|
import toml
|
||||||
import configparser
|
import configparser
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
@ -35,10 +36,13 @@ class ProjectContext(typ.NamedTuple):
|
||||||
|
|
||||||
def init_project_ctx(project_path: typ.Union[str, pl.Path, None] = ".") -> ProjectContext:
|
def init_project_ctx(project_path: typ.Union[str, pl.Path, None] = ".") -> ProjectContext:
|
||||||
"""Initialize ProjectContext from a path."""
|
"""Initialize ProjectContext from a path."""
|
||||||
if isinstance(project_path, str):
|
if isinstance(project_path, pl.Path):
|
||||||
path = pl.Path(project_path)
|
|
||||||
else:
|
|
||||||
path = project_path
|
path = project_path
|
||||||
|
elif project_path is None:
|
||||||
|
path = pl.Path(".")
|
||||||
|
else:
|
||||||
|
# assume it's a str/unicode
|
||||||
|
path = pl.Path(project_path)
|
||||||
|
|
||||||
if (path / "pyproject.toml").exists():
|
if (path / "pyproject.toml").exists():
|
||||||
config_filepath = path / "pyproject.toml"
|
config_filepath = path / "pyproject.toml"
|
||||||
|
|
@ -86,7 +90,7 @@ def _debug_str(cfg: Config) -> str:
|
||||||
f"tag={cfg.tag}",
|
f"tag={cfg.tag}",
|
||||||
f"commit={cfg.commit}",
|
f"commit={cfg.commit}",
|
||||||
f"push={cfg.push}",
|
f"push={cfg.push}",
|
||||||
f"file_patterns={{",
|
"file_patterns={",
|
||||||
]
|
]
|
||||||
|
|
||||||
for filepath, patterns in cfg.file_patterns.items():
|
for filepath, patterns in cfg.file_patterns.items():
|
||||||
|
|
@ -152,7 +156,7 @@ def _parse_cfg(cfg_buffer: typ.TextIO) -> RawConfig:
|
||||||
|
|
||||||
for option, default_val in BOOL_OPTIONS.items():
|
for option, default_val in BOOL_OPTIONS.items():
|
||||||
val: OptionVal = raw_cfg.get(option, default_val)
|
val: OptionVal = raw_cfg.get(option, default_val)
|
||||||
if isinstance(val, str):
|
if isinstance(val, six.text_type):
|
||||||
val = val.lower() in ("yes", "true", "1", "on")
|
val = val.lower() in ("yes", "true", "1", "on")
|
||||||
raw_cfg[option] = val
|
raw_cfg[option] = val
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue