Skip to content

Commit

Permalink
Let native code do the fast buffer overflow retry
Browse files Browse the repository at this point in the history
Plus fixup the build and sdist due to autotoolization of GPX
  • Loading branch information
markwal committed May 3, 2016
1 parent 379e70e commit 46a7e5c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion GPX
Submodule GPX updated from aac018 to ed7cce
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include *.txt
recursive-include octoprint_GPX *.js *.jinja2 *.less *.css
recursive-include GPX *
global-exclude *_obj/* *build/*
recursive-include GPX *.h
recursive-exclude GPX/build *
include GPX/build/src/shared/config.h
include versioneer.py
include octoprint_GPX/_version.py
include README.md
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ SUBDIRS = GPX/build octoprint_GPX/static/less

.PHONY: all clean test machines

all:
python setup.py develop
all: GPX/build
for dir in $(SUBDIRS); do \
echo "Entering $$dir"; \
make -C $$dir $@; \
echo "Exiting $$dir"; \
done
python setup.py develop

GPX/build: GPX/configure
mkdir -p GPX/build
cd GPX/build ; ../configure ; cd ../..

clean:
python setup.py clean
Expand Down
12 changes: 2 additions & 10 deletions octoprint_GPX/gpxprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,13 @@ def write(self, data):
self._append(gpx.write("%s" % data))
break
except gpx.BufferOverflow:
# at first, let's do quick retries in case we're doing
# lots of short movements and we're just ahead of the
# bot
bo_retries += 1
if bo_retries < 10:
continue

# then let's slow down so we're not spinning, could be
# queued with lots of long moves or we could be paused
try:
if gpx.build_paused():
if bo_retries == 11:
if bo_retries == 1:
self._append("// echo: print paused at bot")
time.sleep(1) # 1 sec
elif bo_retries == 11:
elif bo_retries == 1:
self._append("// echo: buffer overflow")
except IOError:
pass
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def params():
ext_modules = [
setuptools.Extension('gpx',
sources = plugin_ext_sources,
extra_compile_args = ['-DGPX_VERSION="\\"OctoPrint\\""', '-DSERIAL_SUPPORT', '-fvisibility=hidden', '-IGPX/src/shared', '-IGPX/src/gpx'],
extra_compile_args = ['-DGPX_VERSION="\\"OctoPrint\\""', '-DSERIAL_SUPPORT', '-fvisibility=hidden', '-IGPX/build/src/shared', '-IGPX/src/shared', '-IGPX/src/gpx'],
extra_link_args = ['-fvisibility=hidden'])
]

Expand Down

0 comments on commit 46a7e5c

Please sign in to comment.