-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from dschep/zipapp
Package ntfy as a PEP441 style zipapp
- Loading branch information
Showing
8 changed files
with
56 additions
and
10 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
*.py[co] | ||
*.egg-info | ||
build | ||
dist | ||
/build | ||
/dist | ||
*travis.log | ||
.eggs | ||
htmlcov | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/python2 | ||
import sys | ||
|
||
from ntfy.cli import main | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
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 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 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 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from os import path, makedirs | ||
from pkgutil import get_data | ||
|
||
from appdirs import user_data_dir | ||
|
||
ntfy_data_dir = user_data_dir('ntfy', 'dschep') | ||
if not path.isdir(ntfy_data_dir): | ||
makedirs(ntfy_data_dir) | ||
|
||
|
||
class icon(object): | ||
png = None | ||
ico = None | ||
for fmt in ['png', 'ico']: | ||
icon_path = path.abspath(path.join(ntfy_data_dir, 'icon.' + fmt)) | ||
setattr(icon, fmt, icon_path) | ||
if not path.isfile(icon_path): | ||
with open(icon_path, 'wb') as icon_file: | ||
icon_file.write(get_data('ntfy', 'icon.' + fmt)) | ||
|
||
scripts = {} | ||
for script in ['auto-ntfy-done.sh', 'bash-preexec.sh']: | ||
script_path = path.abspath(path.join(ntfy_data_dir, script)) | ||
scripts[script] = script_path | ||
if not path.isfile(script_path): | ||
with open(script_path, 'wb') as script_file: | ||
script_file.write(get_data('ntfy', path.join('shell_integration', | ||
script))) |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
PyYAML==3.11 | ||
appdirs==1.4.0 | ||
emoji==0.3.9 | ||
requests==2.9.1 |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
rm -rf build/zipapp | ||
mkdir -p build/zipapp dist | ||
cp __main__.py build/zipapp | ||
pip install --target=build/zipapp -r requirements.txt . | ||
type -P python3.5 &> /dev/null && \ | ||
python3 -m zipapp -o dist/ntfy --python /usr/bin/python2.7 build/zipapp |