Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #4

Merged
merged 4 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
python-version: '3.9.x'
- run: |
pip install -U pip poetry
poetry install
poetry install -E shapely
env:
POETRY_VIRTUALENVS_CREATE: false

Expand All @@ -24,21 +24,24 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.9.x'
- run: |
pip install -U pip poetry
poetry install
env:
POETRY_VIRTUALENVS_CREATE: false

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Poetry install
run: poetry install --no-interaction --no-root
- name: Run the build process
run: poetry run pyinstaller --onefile preprocess_cancellation.py

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
267 changes: 101 additions & 166 deletions poetry.lock

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions preprocess_cancellation.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import json
import logging
import time
import pathlib
import platform
import re
import shutil
import statistics
import sys
import tempfile
from typing import Any, Dict, List, NamedTuple, Optional, Set, Tuple, TypeVar
from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TypeVar

__version__ = "0.1.7"


logging.basicConfig(stream=sys.stderr, level=logging.INFO)
Expand All @@ -25,8 +26,7 @@
except OSError:
logger.exception("Failed to import shapely. Are you missing libgeos?")


HEADER_MARKER = "; Pre-Processed for Cancel-Object support\n"
HEADER_MARKER = f"; Pre-Processed for Cancel-Object support by preprocess_cancellation v{__version__}\n"


PathLike = TypeVar("PathLike", str, pathlib.Path)
Expand Down Expand Up @@ -332,15 +332,19 @@ def preprocess_slicer(infile):
infile.seek(0)
for line in infile:
yield line
if line.strip() and not line.startswith(";"):
break

if line.startswith("; generated by"):
yield from header(len(known_objects))
for object_id, hull in known_objects.values():
yield from define_object(
object_id,
center=hull.center(),
polygon=hull.exterior(),
)
yield from header(len(known_objects))
for object_id, hull in known_objects.values():
yield from define_object(
object_id,
center=hull.center(),
polygon=hull.exterior(),
)

for line in infile:
yield line

if line.startswith("; printing object "):
yield from object_start_marker(known_objects[line.split("printing object")[1].strip()].name)
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "preprocess_cancellation"
version = "0.1.6"
version = "0.1.7"
description = "GCode processor to add klipper cancel-object markers"
readme = "README.md"
authors = ["Franklyn Tackitt <[email protected]>"]
Expand All @@ -17,7 +17,8 @@ preprocess_cancellation = 'preprocess_cancellation:_main'
shapely = [ "shapely" ]

[tool.poetry.dependencies]
python = ">= 3.6.0"
python = ">= 3.6.2"

shapely = { version = "*", optional = true }

[tool.poetry.dev-dependencies]
Expand All @@ -28,6 +29,7 @@ matplotlib = "*"
pyinstaller = "*"
pytest = "*"
pytest-cov = "*"
shapely = "*"

[tool.black]
line_length = 120
Expand Down
Loading