Browse Source

Use pipenv and require Python 3.6

master
Jakub Valenta 2 years ago
parent
commit
72f97f3491
  1. 9
      README.md
  2. 10
      novinky-polls-add-archive-org
  3. 10
      novinky-polls-add-current
  4. 10
      novinky-polls-analyze
  5. 10
      novinky-polls-refresh
  6. 10
      novinky-polls-render-html
  7. 10
      novinky-polls-render-print
  8. 10
      novinky-polls-render-text
  9. 4
      novinky_polls/add_archive_org.py
  10. 4
      novinky_polls/add_current.py
  11. 4
      novinky_polls/analyze.py
  12. 4
      novinky_polls/refresh.py
  13. 4
      novinky_polls/render_html.py
  14. 4
      novinky_polls/render_print.py
  15. 4
      novinky_polls/render_text.py
  16. 7
      novinky_polls/scraper.py
  17. 4
      setup.py

9
README.md

@ -13,20 +13,21 @@ Supported output formats:
### Arch Linux
``` shell
# pacman -S python
$ pip install --user --upgrade .
# pacman -S pipenv
$ make setup
```
### Other systems
Install these dependencies manually:
- Python > 3.4
- Python > 3.6
- pipenv
Then run:
``` shell
$ pip install --user --upgrade .
$ make setup
```
## Usage

10
novinky-polls-add-archive-org

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.add_archive_org
if __name__ == '__main__':
novinky_polls.add_archive_org.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.add_archive_org "$@"

10
novinky-polls-add-current

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.add_current
if __name__ == '__main__':
novinky_polls.add_current.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.add_current "$@"

10
novinky-polls-analyze

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.analyze
if __name__ == '__main__':
novinky_polls.analyze.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.analyze "$@"

10
novinky-polls-refresh

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.refresh
if __name__ == '__main__':
novinky_polls.refresh.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.refresh "$@"

10
novinky-polls-render-html

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.render_html
if __name__ == '__main__':
novinky_polls.render_html.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.render_html "$@"

10
novinky-polls-render-print

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.render_print
if __name__ == '__main__':
novinky_polls.render_print.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.render_print "$@"

10
novinky-polls-render-text

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/bin/bash
import novinky_polls.render_text
if __name__ == '__main__':
novinky_polls.render_text.main()
project_dir=$(dirname "$(readlink -f "$0")")
PIPENV_PIPFILE="$project_dir/Pipfile" \
PYTHONPATH="$project_dir" \
pipenv run python3 -m novinky_polls.render_text "$@"

4
novinky_polls/add_archive_org.py

@ -90,3 +90,7 @@ def main():
args = parser.parse_args()
sys.exit(add_archive_org(args))
if __name__ == '__main__':
main()

4
novinky_polls/add_current.py

@ -46,3 +46,7 @@ def main():
args = parser.parse_args()
sys.exit(add_current(args))
if __name__ == '__main__':
main()

4
novinky_polls/analyze.py

@ -183,3 +183,7 @@ def main():
args = parser.parse_args()
sys.exit(analyze(args))
if __name__ == '__main__':
main()

4
novinky_polls/refresh.py

@ -38,3 +38,7 @@ def main():
reader.refresh_last_poll(args.inputfile, args.cachedir)
sys.exit()
if __name__ == '__main__':
main()

4
novinky_polls/render_html.py

@ -105,3 +105,7 @@ def main():
args = parser.parse_args()
sys.exit(render_html(args))
if __name__ == '__main__':
main()

4
novinky_polls/render_print.py

@ -91,3 +91,7 @@ def main():
args = parser.parse_args()
sys.exit(render_print(args))
if __name__ == '__main__':
main()

4
novinky_polls/render_text.py

@ -61,3 +61,7 @@ def main():
args = parser.parse_args()
sys.exit(render_text(args))
if __name__ == '__main__':
main()

7
novinky_polls/scraper.py

@ -6,11 +6,6 @@ from bs4 import BeautifulSoup
from novinky_polls import analyzer
try:
from os import scandir
except ImportError:
from scandir import scandir # type: ignore
HEADERS = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/42.0', # noqa: E501
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', # noqa: E501
@ -26,7 +21,7 @@ URL = 'http://www.novinky.cz/inquiry/screen?inquiryIds={}'
def cache_read(cache_dir):
cache = {}
for entry in scandir(cache_dir):
for entry in os.scandir(cache_dir):
if not entry.name.startswith('.') and entry.is_file():
m = re.search(r'^(\d+)\.json$', entry.name)
if m:

4
setup.py

@ -4,7 +4,7 @@ from setuptools import find_packages, setup
setup(
name='novinky-polls',
version='1.0.0',
version='1.1.0',
description='Tools to work with Novinky.cz\'s polls',
long_description=(Path(__file__).parent / 'README.md').read_text(),
url='https://lab.saloun.cz/jakub/novinky-polls',
@ -16,7 +16,7 @@ setup(
'Intended Audience :: Developers',
'Topic :: Artistic Software',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.6',
],
keywords='',
packages=find_packages(),

Loading…
Cancel
Save