From 650b3d4bb34ae2002eb01a3f040e88ade5f7b311 Mon Sep 17 00:00:00 2001 From: asdf Date: Wed, 29 Jan 2020 15:19:26 +1100 Subject: [PATCH] Requires Python 3.6, configures tox for testing different Python versions --- .gitignore | 4 ++++ README.md | 11 +++++++++++ linkulator.py | 12 ------------ setup.py | 22 ++++++++++++++++++++++ tox.ini | 13 +++++++++++++ 5 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 setup.py create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 3883e04..8ae8e85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ __pycache__ .mypy_cache +.tox +/*.egg-info +/dist +/build diff --git a/README.md b/README.md index e2b068e..40488f9 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,17 @@ user@server:~$ linkulator Enter a category ID, p to post a link, s to search, or q to quit: ``` +## Prerequisites + +Linkulator requires Python 3.6.9 or greater. If you use an earlier version, you may get the following error: + +```shell + File "./linkulator.py", line 21 + link_data: list = LinkData.link_data + ^ +SyntaxError: invalid syntax +``` + ## Installation Just clone this repo into any location in users' paths. Each user can have their own copy, in case they want to customize it, or you can install a central version in /usr/local/bin. diff --git a/linkulator.py b/linkulator.py index 77f03cc..eb25b60 100755 --- a/linkulator.py +++ b/linkulator.py @@ -446,18 +446,6 @@ def signal_handler(sig, frame): def main(): """main function - handles argument parsing and calls menu system""" - - low_py_ver = 3.6 - py_ver = str(sys.version_info[0]) + "." + str(sys.version_info[1]) - py_ver = float(py_ver) - if py_ver < low_py_ver: - raise Exception( - "Must be using Python " - + str(low_py_ver) - + " or higher. Instead you're using " - + str(py_ver) - ) - signal.signal(signal.SIGINT, signal_handler) args = sys.argv[1:] config.init() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1fbb5b2 --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +from setuptools import setup, find_packages + +with open("README.md", "r") as fh: + long_description = fh.read() + +setup( + name="linkulator", + version="2.0.0", + author="cmccabe", + author_email="rawtext.club", + description="Linkulator is a command line link aggregator; somewhat like news.ycombinator.com, or lobste.rs, but simpler and run from the command line.", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://tildegit.org/cmccabe/linkulator2", + packages=find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: POSIX", + ], + python_requires='>=3.6', +) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..5fd4d18 --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +# tox (https://tox.readthedocs.io/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = py36, py37, py38 + +[testenv] +deps = + +commands = + python3 -m unittest discover -s tests -p "*_test.py"