Skip to content

Commit

Permalink
Move setup-win32.py to root & fix win32 packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
mlt committed Aug 16, 2014
1 parent 6e46401 commit 1fcb055
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 23 deletions.
13 changes: 7 additions & 6 deletions src/setup-win32.py → setup-win32.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import sys
from cx_Freeze import setup, Executable
import requests

# C:\Python27\python setup.py build
# 7z a -xr!*.py* build\exe.win32-2.7\library.zip C:\Python27\Lib\site-packages\pytz

sys.path.append('web')
sys.path.append("schwinn810/web")

# Dependencies are automatically detected, but it might need fine tuning.
#"build_exe": "schwinn810_win32",
# "include-in-shared-zip": ["C:\\Python27\\lib\\site-packages\\pytz\\zoneinfo", "site-packages\\pytz\\zoneinfo"], \
# "zip_includes": [("C:/Python27/Lib/site-packages/pytz/zoneinfo/", "pytz/zoneinfo/")], \
build_exe_options = { "optimize": 2} #, "create-shared-zip": True}
build_exe_options = { "optimize": 2,
"include_files": [(requests.certs.where(), 'cacert.pem')]} #, "create-shared-zip": True}
#"path": [sys.path, "garmin"], "includes": ["UploadGarmin"],

# GUI applications require a different base on Windows (the default is for a
Expand All @@ -24,7 +26,6 @@
description = "Tools for Schwinn 810 GPS sport watch",
options = {"build_exe": build_exe_options},
data_files = [(".", ["schwinn810.cmd", "babelize.cmd"] )],
executables = [Executable("download.py", base=base), \
Executable("settings.py", base=base), \
Executable("csv2tcx.py", base=base), \
Executable("web/tcx2web.py", base=base)])
executables = [Executable("schwinn810/download.py", base=base), \
Executable("schwinn810/csv2tcx.py", base=base), \
Executable("schwinn810/web/tcx2web.py", base=base)])
28 changes: 21 additions & 7 deletions win32/babelize_sample.cmd
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
@echo off
SET "GPSBABEL=C:\Program Files\GPSBabel\gpsbabel.exe"
setlocal

set NAME=%~1

echo Postprocessing "%NAME%"
cd /d "%~dp0"

SET "GPSBABEL=C:\OSGeo4W64\bin\gpsbabel.exe"
SET "Z7=C:\Program Files\7-Zip\7z.exe"
rem SET "Z7=C:\Program Files (x86)\7-Zip\7z.exe"

REM Convert points into GPX and KML
REM See manual for GPSBabel for options
REM For TCX conversion see below
"%GPSBABEL%" -i unicsv,utc=5 -f "%1.points" ^
"%GPSBABEL%" -i unicsv,utc=5 -f "%NAME%.points" ^
-x transform,trk=wpt,del ^
-o gpx -F "%1.gpx" ^
-o kml,lines=1,points=0,track=1,trackdirection=1 -F "%1.kml"
-o gpx -F "%NAME%.gpx" ^
-o kml,lines=1,points=0,track=1,trackdirection=1 -F "%NAME%.kml"

rem -o gtrnctr,sport=Running,course=0 -F %1.tcx ^
rem Compress KML into KMZ
DEL /Q /F "%NAME%.kmz" 2> nul
"%Z7%" a -tzip "%NAME%.kmz" "%NAME%.kml" > nul

%~dp0\csv2tcx.exe "%1" > "%1.tcx"
rem Get TCX
csv2tcx.exe "%NAME%" > "%NAME%.tcx"

REM Make a compressed Google Earth file
REM %COMSPEC% /C DEL /Q /F "%1.kmz"
REM "%Z7%" a -tzip "%1.kmz" "%1.kml" > nul

set REQUESTS_CA_BUNDLE=%~dp0cacert.pem
REM Upload TCX to web. See source code for details
REM %~dp0\tcx2web.exe "%1.tcx"
%~dp0\tcx2web.exe "%NAME%.tcx"

endlocal
22 changes: 14 additions & 8 deletions win32/release.cmd
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
@echo off
setlocal

set CPU=x64
set VER=0.3

set OSGEO4W_ROOT=C:\OSGeo4W64
set PYTHON=%OSGEO4W_ROOT%\bin\python.exe
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27

set VER=0.2rc2
set CPU=x86
set EXT=win32

rd /S /Q build
for /f "usebackq" %%i in (`%PYTHON% -c "import sys;print(sys.maxsize>2**32)"`) do set IS64=%%i

rem set EXT=win32
set EXT=win-amd64
if "%IS64%" == "True" (
set CPU=x64
set EXT=win-amd64
)

rd /S /Q build

pushd ..\src
%OSGEO4W_ROOT%\bin\python setup-win32.py build -b ..\win32\build
pushd ..
%OSGEO4W_ROOT%\bin\python setup-win32.py build -b win32\build
popd

rem pytz now is in egg, unpack relevant files into local pytz subfolder
7za a -xr!*.py* build\exe.%EXT%-2.7\library.zip pytz > nul
rem 7za a -xr!*.py* build\exe.%EXT%-2.7\library.zip %OSGEO4W_ROOT%\apps\python27\lib\site-packages\pytz > nul

copy *_sample.cmd build\exe.%EXT%-2.7\
copy %CPU%\SiUSBXp.dll build\exe.%EXT%-2.7\
copy ..\schwinn810\%CPU%\SiUSBXp.dll build\exe.%EXT%-2.7\

pushd build
ren exe.%EXT%-2.7 schwinn810_%VER%_%EXT%
Expand Down
5 changes: 3 additions & 2 deletions win32/schwinn810_sample.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ SET "GPSBABEL=C:\Programs\GPSBabel\gpsbabel.exe"
SET "Z7=C:\Program Files\7-Zip\7z.exe"

%~dp0\download.exe ^
--port COM4 ^
--hook %~dp0\babelize.cmd ^
--hook %~dp0babelize.cmd ^
--progress qt ^
--delete ^
--debug ^
--dir "%DIR%"

"%GPSBABEL%" -i unicsv,utc=5 -f "%DIR%\waypoints.csv" ^
Expand Down

0 comments on commit 1fcb055

Please sign in to comment.