Skip to content

Commit

Permalink
Merge branch 'kliment:master' into upd_translation
Browse files Browse the repository at this point in the history
  • Loading branch information
DivingDuck committed Mar 7, 2024
2 parents 67f5bc4 + 6b56bf8 commit 7669410
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 260 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build Python sdist and wheels

on:
pull_request:
push:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Build ${{ matrix.os }} wheels
uses: pypa/cibuildwheel@v2.16.5
env:
# we only support what's supported by wxPython, therefore we skip:
# * PyPy Python implementation
# * Python 3.6 and 3.7 versions
# * musl C implementation
CIBW_SKIP: "pp* cp36* cp37* *-musllinux*"
# produce ARM wheels on Linux in addition to 32 and 64 bit
CIBW_ARCHS_LINUX: auto aarch64
# produce wheels for macOS to support both Intel and Apple silicon
CIBW_ARCHS_MACOS: x86_64 universal2 arm64

- name: Upload ${{ matrix.os }} wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
# unpack all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
# by default, the contents of the `dist/` directory are uploaded
password: ${{ secrets.PYPI_API_KEY }}
14 changes: 7 additions & 7 deletions .github/workflows/buildpackage-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
os: [macos-11, macos-12]
os: [macos-12]
architecture: [x64]
python-version: ['3.10']

Expand All @@ -33,11 +33,11 @@ jobs:
python setup.py build_ext --inplace
- name: Make pyinstaller spec
run: |
pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data images/\*:images --add-data \*.png:. --add-data \*.ico:. -w -i P-face.icns pronterface.py
pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data images/\*:images --add-data \*.png:. --add-data \*.ico:. --name Pronterface -w -i P-face.icns pronterface.py
# Edit spec file
export git_hash=$(git rev-parse --short "$GITHUB_SHA")
sed -i '' '$ s/.$//' pronterface.spec
cat >> pronterface.spec <<EOL
sed -i '' '$ s/.$//' Pronterface.spec
cat >> Pronterface.spec <<EOL
info_plist={
'CFBundleShortVersionString': '$git_hash',
'NSPrincipalClass': 'NSApplication',
Expand All @@ -48,10 +48,10 @@ jobs:
EOL
- name: Make pyinstaller build
run: |
pyinstaller --clean pronterface.spec -y
pyinstaller --clean Pronterface.spec -y
# Zip app manually to avoid losing execute permissions for binary file in app
cd dist
zip -r -X pronterface-app.zip pronterface.app
zip -r -X Pronterface-app.zip Pronterface.app
- name: Configuration for releases
if: ${{ github.event_name == 'release' }}
Expand All @@ -72,4 +72,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ env.EXE_NAME }}_${{ matrix.os }}_${{ matrix.architecture }}_py${{ matrix.python-version }}
path: dist/pronterface-app.zip
path: dist/Pronterface-app.zip
45 changes: 0 additions & 45 deletions .github/workflows/pypi-mac.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/pypi-manylinux.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/pypi-sdist.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/pypi-win.yml

This file was deleted.

31 changes: 6 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,15 @@ $ source venv/bin/activate # activate the virtual environment
> **Note for Ubuntu/Debian**: You might need to install `python3-venv` first.
> **Note for Ubuntu/Debian**: If you get `python: command not found` use
> `python3` instead of just `python` on all commands below.
> `python3 -m venv venv` instead.

#### 4. Install dependencies
#### 4. Install Printrun

Dependencies for running Printrun are laid out in the [`requirements.txt`][5]
file. Once activated your virtual environment, install required dependencies
with:
Once activated your virtual environment, install Printrun' source code with:

```
(venv) $ python -m pip install -r requirements.txt # install the rest of dependencies
(venv) $ python -m pip install .
```

> **Note for Linux users**: wxPython4 doesn't have Linux wheels available from
Expand All @@ -186,32 +184,15 @@ with:
> (venv) $ python -m pip install https://extras.wxpython.org/wxPython4/extras/linux/gtk3/fedora-27/wxPython-4.0.1-cp36-cp36m-linux_x86_64.whl # replace the link with yours
> ```
[5]: requirements.txt
[6]: https://extras.wxpython.org/wxPython4/extras/linux/gtk3


#### 5. (Optional) Cython-based G-Code parser

Printrun default G-Code parser is quite memory hungry, but we also provide a
much lighter one which just needs an extra build-time dependency (Cython). The
warning message `WARNING:root:Memory-efficient GCoder implementation
unavailable: No module named gcoder_line` means that this optimized G-Code
parser hasn't been compiled. To get rid of it and benefit from the better
implementation, install Cython and build the extension with the following
commands:

```console
(venv) $ python -m pip install Cython
(venv) $ python setup.py build_ext --inplace
```


#### 6. Run Printrun
#### 5. Run Printrun

With your virtual environment still active, invoke the app you need like:

```shell
(venv) $ python pronterface.py # or `pronsole.py` or `plater.py`
(venv) $ pronterface.py # or `pronsole.py` or `plater.py`
```


Expand Down
2 changes: 1 addition & 1 deletion printrun/pronsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ def recvcb_actions(self, l):
command = command.split(":")
if len(command) == 2 and command[0] == "action":
command = command[1]
if command == "pause":
if command in ["pause", "cancel"]:
self.do_pause(None)
sys.stdout.write(self.promptf())
sys.stdout.flush()
Expand Down
2 changes: 1 addition & 1 deletion printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ def recvcb_actions(self, l):
if len(command) == 2 and command[0] == "action":
command = command[1]
self.log(_("Received command %s") % command)
if command == "pause":
if command in ["pause", "cancel"]:
if not self.paused:
wx.CallAfter(self.pause)
return True
Expand Down

0 comments on commit 7669410

Please sign in to comment.