Skip to content

Commit

Permalink
fix tests: drop setup.py, flake8 lint
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 6, 2024
1 parent 053814b commit 4ee6d02
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 32 deletions.
43 changes: 21 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Makefile:

```
make [<alias>] # on UNIX-like environments
python setup.py make [<alias>] # if make is unavailable
python -m pymake [<alias>] # if make is unavailable
```

Use the alias `help` (or leave blank) to list all available aliases.
Expand Down Expand Up @@ -50,7 +50,7 @@ The standard way to run the tests:
- run the following command:
```
[python setup.py] make test
[python -m py]make test
# or:
tox --skip-missing-interpreters
```
Expand All @@ -71,11 +71,11 @@ Alternative unit tests with PyTest
Alternatively, use `pytest` to run the tests just for the current Python version:
- install `pytest` and `flake8`
- install `pytest`, `flake8` and `flake8-pyproject`
- run the following command:
```
[python setup.py] make alltests
[python -m py]make alltests
```
Expand All @@ -85,7 +85,7 @@ MANAGE A NEW RELEASE
This section is intended for the project's maintainers and describes
how to build and upload a new release. Once again,
`[python setup.py] make [<alias>]` will help.
`[python -m py]make [<alias>]` will help.
SEMANTIC VERSIONING
Expand All @@ -104,21 +104,21 @@ Note: tools can be used to automate this process, such as
[python-semanticversion](https://github.com/rbarrois/python-semanticversion/).
CHECKING SETUP.PY
-----------------
CHECKING SETUP
--------------
To check that the `setup.py` file is compliant with PyPi requirements (e.g.
To check that the setup is compliant with PyPi requirements (e.g.
version number; reStructuredText in README.rst) use:
```
[python setup.py] make testsetup
[python -m py]make testsetup
```
To upload just metadata (including overwriting mistakenly uploaded metadata)
to PyPi, use:
```
[python setup.py] make pypimeta
[python -m py]make pypimeta
```
Expand Down Expand Up @@ -172,7 +172,7 @@ git merge --no-ff pr-branch-name
~~~~~~
```
[python setup.py] make alltests
[python -m py]make alltests
```
5 Version
Expand Down Expand Up @@ -202,9 +202,8 @@ Test
~~~~
- ensure that all online CI tests have passed
- check `setup.py` and `MANIFEST.in` - which define the packaging
process and info that will be uploaded to [pypi](pypi.python.org) -
using `[python setup.py] make installdev`
- check setup - which define the packaging process and info that will be uploaded to [pypi](pypi.python.org) -
using `[python -m py]make install_dev`
Tag
~~~
Expand All @@ -221,7 +220,7 @@ Upload
Build pymake into a distributable python package:
```
[python setup.py] make build
[python -m py]make build
```
This will generate several builds in the `dist/` folder. On non-windows
Expand All @@ -231,12 +230,12 @@ Finally, upload everything to pypi. This can be done easily using the
[twine](https://github.com/pypa/twine) module:
```
[python setup.py] make pypi
[python -m py]make pypi
```
Also, the new release can (should) be added to `github` by creating a new
release from the web interface; uploading packages from the `dist/` folder
created by `[python setup.py] make build`.
created by `[python -m py]make build`.
Notes
~~~~~
Expand All @@ -246,7 +245,7 @@ before the real deployment
- in case of a mistake, you can delete an uploaded release on pypi, but you
cannot re-upload another with the same version number
- in case of a mistake in the metadata on pypi (e.g. bad README),
updating just the metadata is possible: `[python setup.py] make pypimeta`
updating just the metadata is possible: `[python -m py]make pypimeta`
QUICK DEV SUMMARY
Expand All @@ -255,12 +254,12 @@ QUICK DEV SUMMARY
For expereinced devs, once happy with local master:
1. bump version in `pymake/_version.py`
2. test (`[python setup.py] make alltests`)
2. test (`[python -m py]make alltests`)
3. `git commit [--amend] # -m "bump version"`
4. `git push`
5. wait for tests to pass
a) in case of failure, fix and go back to (2)
6. `git tag vM.m.p && git push --tags`
7. `[python setup.py] make distclean`
8. `[python setup.py] make build`
9. `[python setup.py] make pypi`
7. `[python -m py]make distclean`
8. `[python -m py]make build`
9. `[python -m py]make pypi`
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IMPORTANT: for compatibility with `python setup.py make [alias]`, ensure:
# IMPORTANT: for compatibility with `python -m pymake [alias]`, ensure:
# 1. Every alias is preceded by @[+]make (eg: @make alias)
# 2. A maximum of one @make alias or command per line
# see: https://github.com/tqdm/py-make/issues/1
Expand Down Expand Up @@ -27,7 +27,7 @@
run

help:
@python setup.py make -p
@python -m pymake -p

alltests:
@+make testcoverage
Expand Down
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ Sample makefile compatible with ``pymake``:
test:
pytest
install:
python setup.py\
install
python -m pip install
compile:
$(PY) test.py
circle:
Expand Down
10 changes: 5 additions & 5 deletions pymake/_pymake.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def parse_makefile_aliases(filepath):
ini_lines = ['[root]'] + list(ini_lines)

# Substitute macros
macros = dict(found for l in ini_lines
for found in RE_MACRO_DEF.findall(l) if found)
macros = dict(found for line in ini_lines
for found in RE_MACRO_DEF.findall(line) if found)
ini_str = '\n'.join(ini_lines)
# allow finite amount of nesting
for _ in range(99):
for (m, expr) in getattr(macros, 'iteritems', macros.items)():
ini_str = re.sub(r"\$\(%s\)" % m, expr, ini_str)
if not RE_MACRO.search(ini_str):
# Strip macro definitions for rest of parsing
ini_str = '\n'.join(l for l in ini_str.splitlines()
if not RE_MACRO_DEF.search(l))
ini_str = '\n'.join(line for line in ini_str.splitlines()
if not RE_MACRO_DEF.search(line))
break
else:
raise PymakeKeyError("No substitution for macros: " +
Expand Down Expand Up @@ -140,6 +140,6 @@ def execute_makefile_commands(
# Launch the command and wait to finish (synchronized call)
try:
check_call(parsed_cmd)
except:
except Exception:
if not ignore_errors:
raise
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ allowlist_externals=codacy
[testenv:check]
deps=
flake8
flake8-pyproject
build
twine
commands=
flake8 -j 8 --count --statistics .
{envpython} -m build
{envpython} -m twine check dist/*
{envpython} setup.py make none
{envpython} -m pymake none

0 comments on commit 4ee6d02

Please sign in to comment.