-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make .sh scripts Windows compatible (Mingw). Release 0.1.1.
- Loading branch information
Showing
5 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,7 @@ pip install --editable git://github.com/elonen/lanscatter.git#egg=lanscatter | |
``` | ||
git clone git+ssh://[email protected]/elonen/lanscatter.git | ||
cd lanscatter | ||
python3.7 -m venv venv | ||
source venv/bin/activate | ||
python setup.py develop | ||
./init-env.sh # on Windows requires Mingw (Git Bash) or Cygwin | ||
``` | ||
|
||
Either way, you can now type `lanscatter_master`, `lanscatter_peer` or `lanscatter_gui` on the command line. | ||
|
@@ -105,7 +103,7 @@ Notable modules: | |
|
||
## Testing | ||
|
||
The `tests` folder contains integration and unit tests using the _pytest_ framework. | ||
The `tests` folder contains integration and unit tests using the _pytest_ framework; simply the environment and run `pytest`. | ||
|
||
Integration test – in short – runs a master node and several peer node simultaneously, with random sync dir contents, and makes sure they get in sync without errors. | ||
|
||
|
@@ -161,6 +159,11 @@ Numbers on the right show current downloads, current uploads and average time it | |
|
||
See `planner.plan_transfers()` for details on how planning algorithm works. | ||
|
||
## Building | ||
|
||
Being a Python package, Lanscatter doesn't require building, but if you want to package .exe binaries for | ||
Windows , run `pyinstaller-build.sh` in _Git Bash_ (Mingw) or Cygwin. | ||
|
||
## License | ||
|
||
Copyright 2019 Jarno Elonen <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
PYTHON=python3.7 | ||
REQ=requirements.txt | ||
ACTIVATE=venv/bin/activate | ||
|
||
if (uname | grep -q -E '(CYGWIN|MINGW)'); then | ||
echo "NOTE: Windows OS detected. Using 'python' instead of '$PYTHON'." | ||
PYTHON=python | ||
ACTIVATE=venv/Scripts/activate | ||
fi | ||
|
||
if (uname | grep -q -E 'Linux'); then | ||
echo "NOTE: Linux OS detected. Skipping installing GUI packages (failing ATM)." | ||
REQ=requirements.cli.txt | ||
fi | ||
|
||
if [ ! -e venv ]; then | ||
python3.7 -m venv venv | ||
$PYTHON -m venv venv | ||
fi | ||
source venv/bin/activate || { echo "Venv activation failed."; exit 1; } | ||
pip install -r requirements.txt | ||
|
||
source $ACTIVATE || { echo "Venv activation failed."; exit 1; } | ||
pip install -r $REQ | ||
python ./setup.py develop | ||
|
||
echo " " | ||
echo "---" | ||
echo "Done. First run 'source venv/bin/activate'" | ||
echo "Done. First run 'source $ACTIVATE'" | ||
echo "Then try 'lanscatter_master --help', 'lanscatter_peer' or 'lanscatter_gui'." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
#!/bin/bash | ||
if [ ! -e venv ]; then | ||
python3.7 -m venv venv | ||
PYTHON=python3.7 | ||
REQ=requirements.txt | ||
ACTIVATE=venv/bin/activate | ||
set -e | ||
|
||
VER=$(git describe --exact-match 2> /dev/null || echo "`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\"%h\" -1`") | ||
echo "Current version string is: '$VER'" | ||
|
||
if (uname | grep -q -E '(CYGWIN|MINGW)'); then | ||
echo "NOTE: Windows OS detected. Using 'python' instead of '$PYTHON'." | ||
PYTHON=python | ||
ACTIVATE=venv/Scripts/activate | ||
fi | ||
source venv/bin/activate || { echo "Venv activation failed."; exit 1; } | ||
pip install -r requirements.txt | ||
|
||
if (uname | grep -q -E 'Linux'); then | ||
echo "NOTE: Linux OS detected. Skipping installing GUI packages (failing ATM)." | ||
REQ=requirements.cli.txt | ||
fi | ||
|
||
source $ACTIVATE || { echo "Venv activation failed."; exit 1; } | ||
pip install -r $REQ | ||
|
||
echo " " | ||
pytest || { echo "Tests failed, will not continue with pyinstaller."; exit 1; } | ||
python ./setup.py develop | ||
python ./setup.py pyinstaller -- --noconsole --onefile --add-data 'gfx/*:gfx' --icon gfx/icon.ico | ||
|
||
if (uname | grep -q -E '(CYGWIN|MINGW)'); then | ||
ZIPFILE="lanscatter-win32_$VER.zip" | ||
python setup.py pyinstaller -- --noconsole --onefile --add-data "gfx/*;gfx" --icon gfx/icon.ico | ||
cp dist/lanscatter_gui.exe ./ | ||
rm -rf dist | ||
python setup.py pyinstaller -- --onefile | ||
cp dist/lanscatter_master.exe dist/lanscatter_peer.exe ./ | ||
rm -f lanscatter-win32.zip | ||
python -c "import zipfile, glob; z=zipfile.ZipFile('$ZIPFILE', 'w'); [z.write(f) for f in glob.glob('*.exe')]" | ||
rm -- *.exe | ||
echo "--- DONE. Windows binaries built and packaged into $ZIPFILE" | ||
|
||
else | ||
echo "--- NOTE: We are not on Windows, so binaries will stay in dist/." | ||
python ./setup.py pyinstaller -- --noconsole --onefile --add-data 'gfx/*:gfx' --icon gfx/icon.ico | ||
fi | ||
|
||
rm -rf dist | ||
rm -f lanscatter_*.spec |