Skip to content

Commit

Permalink
lxa_iobus: move the project from setup.py to pyproject.toml
Browse files Browse the repository at this point in the history
The pyproject.toml format is the new and modern way to package python
projects. We still use setuptools under the hood to do the packaging,
but configure it in the pyproject.toml.

This change also moves the executable scripts from the bin folder,
where they were e.g. not caught by flake8 and black by default,
into the python project folder itself.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
  • Loading branch information
hnez committed Mar 13, 2024
1 parent eb8a0d0 commit 0efbea9
Show file tree
Hide file tree
Showing 15 changed files with 230 additions and 323 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,3 @@ jobs:
uses: cytopia/docker-black@0.8
with:
path: '.'
- name: Python Black
uses: cytopia/docker-black@0.8
with:
path: 'bin/lxa-iobus-lpc11xxcanisp-invoke'
- name: Python Black
uses: cytopia/docker-black@0.8
with:
path: 'bin/lxa-iobus-lpc11xxcanisp-program'
- name: Python Black
uses: cytopia/docker-black@0.8
with:
path: 'bin/lxa-iobus-server'
3 changes: 0 additions & 3 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ jobs:
- uses: actions/checkout@v4
- run: python3 -m pip install flake8 flake8-pyproject
- run: flake8 .
- run: flake8 bin/lxa-iobus-lpc11xxcanisp-invoke
- run: flake8 bin/lxa-iobus-lpc11xxcanisp-program
- run: flake8 bin/lxa-iobus-server
36 changes: 1 addition & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PYTHON_TESTING_ENV=$(PYTHON_VENV)-qa
INTERFACE=can0
LSS_ADDRESS_CACHE_FILE=lss-address-cache.json

$(PYTHON_VENV)/.created: setup.py
$(PYTHON_VENV)/.created: pyproject.toml
rm -rf $(PYTHON_VENV) && \
$(PYTHON) -m venv $(PYTHON_VENV) && \
. $(PYTHON_VENV)/bin/activate && \
Expand All @@ -24,37 +24,3 @@ server: env
$(INTERFACE) \
--lss-address-cache-file=$(LSS_ADDRESS_CACHE_FILE) \
$(args)

# packaging environment #######################################################
$(PYTHON_PACKAGING_VENV)/.created: REQUIREMENTS.packaging.txt
rm -rf $(PYTHON_PACKAGING_VENV) && \
$(PYTHON) -m venv $(PYTHON_PACKAGING_VENV) && \
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
pip install --upgrade pip && \
pip install -r REQUIREMENTS.packaging.txt
date > $(PYTHON_PACKAGING_VENV)/.created

packaging-env: $(PYTHON_PACKAGING_VENV)/.created

sdist: packaging-env
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
rm -rf dist *.egg-info && \
./setup.py sdist

_release: sdist
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
twine upload dist/*

# testing #####################################################################
$(PYTHON_TESTING_ENV)/.created: REQUIREMENTS.qa.txt
rm -rf $(PYTHON_TESTING_ENV) && \
$(PYTHON) -m venv $(PYTHON_TESTING_ENV) && \
. $(PYTHON_TESTING_ENV)/bin/activate && \
pip install pip --upgrade && \
pip install -r ./REQUIREMENTS.qa.txt && \
date > $(PYTHON_TESTING_ENV)/.created

qa: $(PYTHON_TESTING_ENV)/.created
. $(PYTHON_TESTING_ENV)/bin/activate && \
black --check --diff . && \
flake8
2 changes: 0 additions & 2 deletions REQUIREMENTS.packaging.txt

This file was deleted.

5 changes: 0 additions & 5 deletions REQUIREMENTS.qa.txt

This file was deleted.

34 changes: 0 additions & 34 deletions bin/lxa-iobus-can-setup

This file was deleted.

184 changes: 0 additions & 184 deletions bin/lxa-iobus-server

This file was deleted.

2 changes: 0 additions & 2 deletions lxa_iobus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
VERSION = (0, 4, 2)
VERSION_STRING = "{}".format(".".join([str(i) for i in VERSION]))
Empty file added lxa_iobus/cli/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions bin/lxa-iobus-lpc11xxcanisp-invoke → lxa_iobus/cli/lpc11xxcanisp_invoke.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def invoke_isp(self):
self.node.sdo.download(0x2B07, 0, struct.pack("I", 0x12345678))


def invoke_rom_loader():
def main():
can = CanOpen()
can.setup()

Expand All @@ -38,4 +38,4 @@ def invoke_rom_loader():


if __name__ == "__main__":
invoke_rom_loader()
main()
File renamed without changes.
Loading

0 comments on commit 0efbea9

Please sign in to comment.