diff --git a/.travis.yml b/.travis.yml index c5246750c..756c14df7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,13 @@ matrix: env: LINT=true sudo: false - # only bother to build if we're going to deploy a release - python: 2.7 sudo: required - env: BUILD=true + env: BUILD=linux + if: tag =~ ^v[0-9.]+$ OR branch != master + - python: 2.7 + sudo: required + env: BUILD=windows if: tag =~ ^v[0-9.]+$ OR branch != master branches: except: @@ -27,16 +30,17 @@ cache: pip install: - | if [ -n "$BUILD" ]; then + # Need this for inkex.py and friends + wget -q https://inkscape.org/en/gallery/item/11254/inkscape-0.92.2.tar.bz2 + tar jxf inkscape-0.92.2.tar.bz2 + rm inkscape-0.92.2.tar.bz2 + fi + if [ "$BUILD" = "linux" ]; then # For some bizarre reason, this build has been failing due to the # key for the mongodb repo expiring. Maybe Travis includes the # mongodb repo by default...? sudo rm /etc/apt/sources.list.d/mongodb*.list - # Need inkscape >=0.92 for inkex.py and friends - sudo add-apt-repository --yes ppa:inkscape.dev/stable - sudo apt-get update - sudo apt-get install inkscape - # for shapely sudo apt-get install libgeos-dev @@ -61,7 +65,38 @@ install: pip install --no-binary shapely -r requirements.txt pip install pyinstaller - else + elif [ "$BUILD" = "windows" ]; then + set -x + + sudo add-apt-repository ppa:ubuntu-wine/ppa -y + sudo apt-get update -qq + export DISPLAY=:99.0 + sh -e /etc/init.d/xvfb start + sleep 3 + sudo apt-get install -y wine + + export WINEDEBUG=-all + + wget -q https://github.com/lexelby/inkstitch-build-objects/releases/download/v1.0.0/windows-libembroidery.tar.gz + tar zxf windows-libembroidery.tar.gz + rm windows-libembroidery.tar.gz + + wget -q http://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe + wine vcredist_x86.exe /q + + wget -q https://www.python.org/ftp/python/2.7.14/python-2.7.14.msi --output-document=python.msi + wine msiexec /i python.msi /qn TARGETDIR=C:\\Python + + wine c:\\Python\\python.exe c:\\Python\\scripts\\pip.exe install pyinstaller --upgrade + wine c:\\Python\\python.exe c:\\Python\\scripts\\pip.exe install setuptools --upgrade + + wget -q https://github.com/lexelby/inkstitch-build-objects/releases/download/v1.0.0/Shapely-1.6.3-cp27-cp27m-win32.whl + wine c:\\Python\\python.exe c:\\Python\\scripts\\pip.exe install Shapely-1.6.3-cp27-cp27m-win32.whl + + wine c:\\Python\\python.exe c:\\Python\\scripts\\pip.exe install -r requirements.txt + + set +x + elif [ -n "$LINT" ]; then pip install flake8 fi before_script: @@ -71,13 +106,17 @@ script: if [ -n "$LINT" ]; then flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=embroidermodder flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=embroidermodder - elif [ -n "$BUILD" ]; then + elif [ "$BUILD" = "linux" ]; then ( cd embroidermodder/experimental qmake swigpython.pro make ) make dist + elif [ "$BUILD" = "windows" ]; then + # work around some bug... pyinstaller? shapely? not sure. + cp $(winepath 'C:\Python\lib\site-packages\shapely\DLLs\geos_c.dll') $(winepath 'C:\Python\lib\site-packages\shapely\DLLs\geos.dll') + make dist else true fi @@ -104,6 +143,7 @@ deploy: secure: pYORXHcn0hPcMIo6+brVE+wYce272H4COp1iXmPvBUz64MAX0Bdm5UX6cTAvzwNd9Hhi2nnWebaoS5AiPelbZgQoZJXsy4whrp7+ZrkQZkhGcqsSqXN6j5k5xdGeFX4k37T7eGkFyajTAdIWB3locHcikKN6N6PnyCPxGD/xuxiD1fJSVKGqBOptBYsqFtMddKy3aT0nmRG/2pMElq2Fcxozo+rR00j2/3npVoh2VTRt2L0S/DrX3zKT4vi2+AQ1MmKEAfF/YxCPybJGPe+wHz4egs0+PIJYb7pSZL8Ja81IS4v5cmmy/r2la815amyRyXwZXbJwBX8h9wPa7dwGStMvJdUidlqaXjKMsWba3QbD6YHOi0+UOFvWeubCDqXKhqxVAvZyCvXCx2WPlBfGWsJDHK/j2pU5Iul5Jz2Zsa3PLYA3UeGWVy081SZNuklNdccKGTokntFnR3pGM/jDN/JK7RkvuPM5qQqn3gludQnrdo/Kw0I77hAEDasgUyO8cweSfyqOXBN0dkbLjfBVRslRRRuC5fV9MIqFvLclaPfMlxsSTdDO4MGJRsF7VvFySBdh0xK7Rm+Vb9jYjCR3FV+b8TRsnY0eD2eFM+rmQt/OYdNIs6emVrTXCcAIzq4JoKZdFDIDDRsiztGSjIBB0+rSXmiUMtCiUo5GS/7zxGs= file: - '*.tar.gz' + - '*.zip' file_glob: true skip_cleanup: true prerelease: true diff --git a/Makefile b/Makefile index 3a38e08b0..fdfb50884 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,11 @@ dist: distclean locales bin/build-dist $(EXTENSIONS) cp *.inx dist mv locales dist/inkstitch/bin - cd dist; tar zcf ../inkstitch-$(VERSION)-$(OS)-$(ARCH).tar.gz * + if [ "$$BUILD" = "windows" ]; then \ + cd dist; zip -r ../inkstitch-$(VERSION)-win32.zip *; \ + else \ + cd dist; tar zcf ../inkstitch-$(VERSION)-$(OS)-$(ARCH).tar.gz *; \ + fi distclean: rm -rf build dist *.spec *.tar.gz diff --git a/bin/build-dist b/bin/build-dist index 4f134aabd..8fa4b59f9 100755 --- a/bin/build-dist +++ b/bin/build-dist @@ -2,9 +2,11 @@ site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")" -# pyinstaller misses these two -pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so:. " -pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. " +if [ "$TRAVIS_OS_NAME" = "linux" -a "$BUILD" != "windows" ]; then + # pyinstaller misses these two + pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so:. " + pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. " +fi # This one's tricky. ink/stitch doesn't actually _use_ gi.repository.Gtk, # but it does use GTK (through wxPython). pyinstaller has some special @@ -15,17 +17,27 @@ pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. " # above! pyinstaller_args+="--hidden-import gi.repository.Gtk " -# This lets pyinstaller see inkex.py, etc. -pyinstaller_args+="-p /usr/share/inkscape/extensions " +# mac and windows build seem to miss wx and libembroidery import +pyinstaller_args+="--hidden-import wx --hidden-import libembroidery " -# for libembroidery -pyinstaller_args+="-p embroidermodder/experimental/python/binding " +if [ -d windows-libembroidery ]; then + pyinstaller_args+="-p windows-libembroidery " +else + pyinstaller_args+="-p embroidermodder/experimental/python/binding " +fi + +# This lets pyinstaller see inkex.py, etc. +pyinstaller_args+="-p inkscape-0.92.2/share/extensions " mkdir -p dist/inkstitch/bin for extension in "$@"; do - # without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of - # wxpython's shared libraries - LD_LIBRARY_PATH="${site_packages}/wx" pyinstaller $pyinstaller_args ${extension}.py; + if [ "$BUILD" = "windows" ]; then + wine c:\\Python\\scripts\\pyinstaller.exe $pyinstaller_args ${extension}.py + else + # without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of + # wxpython's shared libraries + LD_LIBRARY_PATH="${site_packages}/wx" pyinstaller $pyinstaller_args ${extension}.py; + fi # By default, pyinstaller will treat each of ink/stitch's extensions # separately. This means it packages a lot of the same shared libraries (like diff --git a/embroider_params.py b/embroider_params.py index 1bb6620e5..f41a667ef 100644 --- a/embroider_params.py +++ b/embroider_params.py @@ -287,7 +287,7 @@ class ParamsTab(ScrolledPanel): summary_box = wx.StaticBox(self, wx.ID_ANY, label=_("Inkscape objects")) sizer = wx.StaticBoxSizer(summary_box, wx.HORIZONTAL) # sizer = wx.BoxSizer(wx.HORIZONTAL) - self.description = wx.StaticText(self, style=wx.TE_WORDWRAP) + self.description = wx.StaticText(self) self.update_description() self.description.SetLabel(self.description_text) self.description_container = box @@ -757,7 +757,7 @@ class EmbroiderParams(inkex.Effect): def save_stderr(): # GTK likes to spam stderr, which inkscape will show in a dialog. - null = open('/dev/null', 'w') + null = open(os.devnull, 'w') sys.stderr_dup = os.dup(sys.stderr.fileno()) os.dup2(null.fileno(), 2) sys.stderr_backup = sys.stderr diff --git a/embroider_simulate.py b/embroider_simulate.py index 979668b05..5340dda7a 100644 --- a/embroider_simulate.py +++ b/embroider_simulate.py @@ -260,7 +260,7 @@ class EmbroiderySimulator(wx.Frame): def on_paint(self, e): dc = wx.PaintDC(self.panel) - dc.DrawBitmap(self.buffer, 0, 0) + dc.Blit(0, 0, self.buffer.GetWidth(), self.buffer.GetHeight(), self.dc, 0, 0) if self.last_pos: dc.DrawLine(self.last_pos[0] - 10, self.last_pos[1], self.last_pos[0] + 10, self.last_pos[1]) diff --git a/inkstitch.py b/inkstitch.py index 0af7807c4..6db9d0036 100644 --- a/inkstitch.py +++ b/inkstitch.py @@ -31,7 +31,7 @@ SVG_GROUP_TAG = inkex.addNS('g', 'svg') EMBROIDERABLE_TAGS = (SVG_PATH_TAG, SVG_POLYLINE_TAG) -dbg = open("/tmp/embroider-debug.txt", "w") +dbg = open(os.devnull, "w") _ = lambda message: message diff --git a/messages.po b/messages.po index 1fa955e75..c7794f316 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-17 10:13-0500\n" +"POT-Creation-Date: 2018-02-19 20:13-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whl b/python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whl new file mode 100644 index 000000000..786e37568 Binary files /dev/null and b/python-wheels/Shapely-1.6.3-cp27-cp27m-win32.whl differ