We assume that websocket.send is a coroutine. This is only true as
of 3.0. We will also need low-level web app runners for the CLI,
which are also only available as of 3.0.
... | ... |
@@ -17,7 +17,7 @@ |
17 | 17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
|
19 | 19 |
import sys |
20 |
-from setuptools import setup |
|
20 |
+from setuptools import setup, find_packages |
|
21 | 21 |
|
22 | 22 |
|
23 | 23 |
if sys.version_info < (3, 6): |
... | ... |
@@ -67,6 +67,16 @@ def get_version_and_cmdclass(package_name): |
67 | 67 |
version, cmdclass = get_version_and_cmdclass('nord') |
68 | 68 |
|
69 | 69 |
|
70 |
+class sdist(cmdclass['sdist']): |
|
71 |
+ def run(self): |
|
72 |
+ import subprocess |
|
73 |
+ subprocess.check_call(['yarn', 'install']) |
|
74 |
+ subprocess.check_call(['yarn', 'build']) |
|
75 |
+ super().run() |
|
76 |
+ |
|
77 |
+ |
|
78 |
+cmdclass.update(dict(sdist=sdist)) |
|
79 |
+ |
|
70 | 80 |
setup( |
71 | 81 |
name='nord', |
72 | 82 |
author='Joseph Weston', |
... | ... |
@@ -77,7 +87,7 @@ setup( |
77 | 87 |
url='https://github.com/jbweston/nord', |
78 | 88 |
cmdclass=cmdclass, |
79 | 89 |
platforms=['GNU/Linux'], |
80 |
- packages=['nord'], |
|
90 |
+ packages=find_packages('.'), |
|
81 | 91 |
long_description=long_description, |
82 | 92 |
install_requires=requirements, |
83 | 93 |
extras_require={ |
... | ... |
@@ -87,4 +97,6 @@ setup( |
87 | 97 |
[console_scripts] |
88 | 98 |
nord=nord.cli:main |
89 | 99 |
''', |
100 |
+ package_data={'nord.web': ['static/*']}, |
|
101 |
+ include_package_data=True, |
|
90 | 102 |
) |
... | ... |
@@ -19,8 +19,6 @@ |
19 | 19 |
import sys |
20 | 20 |
from setuptools import setup |
21 | 21 |
|
22 |
-import versioneer |
|
23 |
- |
|
24 | 22 |
|
25 | 23 |
if sys.version_info < (3, 6): |
26 | 24 |
print('nord requires Python 3.6 or above.') |
... | ... |
@@ -54,15 +52,30 @@ classifiers =[ |
54 | 52 |
with open('README.rst') as readme_file: |
55 | 53 |
long_description = readme_file.read() |
56 | 54 |
|
55 |
+ |
|
56 |
+# Loads _version.py module without importing the whole package. |
|
57 |
+def get_version_and_cmdclass(package_name): |
|
58 |
+ import os |
|
59 |
+ from importlib.util import module_from_spec, spec_from_file_location |
|
60 |
+ spec = spec_from_file_location('version', |
|
61 |
+ os.path.join(package_name, '_version.py')) |
|
62 |
+ module = module_from_spec(spec) |
|
63 |
+ spec.loader.exec_module(module) |
|
64 |
+ return module.__version__, module.cmdclass |
|
65 |
+ |
|
66 |
+ |
|
67 |
+version, cmdclass = get_version_and_cmdclass('nord') |
|
68 |
+ |
|
69 |
+ |
|
57 | 70 |
setup( |
58 | 71 |
name='nord', |
59 | 72 |
author='Joseph Weston', |
60 | 73 |
author_email='joseph@weston.cloud', |
61 | 74 |
description='Unofficial NordVPN client', |
62 | 75 |
license='GNU General Public License v3', |
63 |
- version=versioneer.get_version(), |
|
76 |
+ version=version, |
|
64 | 77 |
url='https://github.com/jbweston/nord', |
65 |
- cmdclass=versioneer.get_cmdclass(), |
|
78 |
+ cmdclass=cmdclass, |
|
66 | 79 |
platforms=['GNU/Linux'], |
67 | 80 |
packages=['nord'], |
68 | 81 |
long_description=long_description, |
... | ... |
@@ -16,11 +16,16 @@ |
16 | 16 |
# You should have received a copy of the GNU General Public License |
17 | 17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
|
19 |
+import sys |
|
19 | 20 |
from setuptools import setup |
20 | 21 |
|
21 | 22 |
import versioneer |
22 | 23 |
|
23 | 24 |
|
25 |
+if sys.version_info < (3, 6): |
|
26 |
+ print('nord requires Python 3.6 or above.') |
|
27 |
+ sys.exit(1) |
|
28 |
+ |
|
24 | 29 |
requirements = [ |
25 | 30 |
'decorator', |
26 | 31 |
'structlog', |
Automatically enforce Python 3
Joseph Weston authored on 24/02/2018 15:00:01... | ... |
@@ -41,12 +41,24 @@ classifiers =[ |
41 | 41 |
'Programming Language :: Python :: 3.6', |
42 | 42 |
'Intended Audience :: End Users/Desktop', |
43 | 43 |
'Intended Audience :: Developers', |
44 |
+ 'Topic :: Utilities', |
|
44 | 45 |
] |
45 | 46 |
|
47 |
+with open('README.rst') as readme_file: |
|
48 |
+ long_description = readme_file.read() |
|
49 |
+ |
|
46 | 50 |
setup( |
47 | 51 |
name='nord', |
52 |
+ author='Joseph Weston', |
|
53 |
+ author_email='joseph@weston.cloud', |
|
54 |
+ description='Unofficial NordVPN client', |
|
55 |
+ license='GNU General Public License v3', |
|
48 | 56 |
version=versioneer.get_version(), |
57 |
+ url='https://github.com/jbweston/nord', |
|
49 | 58 |
cmdclass=versioneer.get_cmdclass(), |
59 |
+ platforms=['GNU/Linux'], |
|
60 |
+ packages=['nord'], |
|
61 |
+ long_description=long_description, |
|
50 | 62 |
install_requires=requirements, |
51 | 63 |
extras_require={ |
52 | 64 |
'dev': dev_requirements, |
Closes #13
Joseph Weston authored on 09/09/2017 19:26:18... | ... |
@@ -24,6 +24,7 @@ requirements = [ |
24 | 24 |
'decorator', |
25 | 25 |
'structlog', |
26 | 26 |
'aiohttp', |
27 |
+ 'termcolor', |
|
27 | 28 |
] |
28 | 29 |
|
29 | 30 |
dev_requirements = [ |
... | ... |
@@ -47,4 +48,8 @@ setup( |
47 | 48 |
extras_require={ |
48 | 49 |
'dev': dev_requirements, |
49 | 50 |
}, |
51 |
+ entry_points=''' |
|
52 |
+ [console_scripts] |
|
53 |
+ nord=nord.cli:main |
|
54 |
+ ''', |
|
50 | 55 |
) |
Previously we required the nord process to have root permission,
now we farm out writing resolv.conf to subprocess, so that we can
rely on sudo.
Closes #9
Joseph Weston authored on 08/09/2017 00:42:42... | ... |
@@ -30,6 +30,15 @@ dev_requirements = [ |
30 | 30 |
'pylint', |
31 | 31 |
] |
32 | 32 |
|
33 |
+classifiers =[ |
|
34 |
+ 'Development Status :: 2 - Pre-Alpha', |
|
35 |
+ 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', |
|
36 |
+ 'Operating System :: POSIX :: Linux', |
|
37 |
+ 'Programming Language :: Python :: 3.6', |
|
38 |
+ 'Intended Audience :: End Users/Desktop', |
|
39 |
+ 'Intended Audience :: Developers', |
|
40 |
+] |
|
41 |
+ |
|
33 | 42 |
setup( |
34 | 43 |
name='nord', |
35 | 44 |
version=versioneer.get_version(), |
The prevailing wisdom seems to be to reserve 'requirements.txt' for
pinning dependency versions for applications, rather than specifying
general dependencies for libraries.
Closes #14
... | ... |
@@ -19,12 +19,23 @@ from setuptools import setup |
19 | 19 |
|
20 | 20 |
import versioneer |
21 | 21 |
|
22 |
-with open('requirements.txt') as r: |
|
23 |
- requirements = [l.strip() for l in r.readlines()] |
|
22 |
+ |
|
23 |
+requirements = [ |
|
24 |
+ 'decorator', |
|
25 |
+ 'structlog', |
|
26 |
+ 'aiohttp', |
|
27 |
+] |
|
28 |
+ |
|
29 |
+dev_requirements = [ |
|
30 |
+ 'pylint', |
|
31 |
+] |
|
24 | 32 |
|
25 | 33 |
setup( |
26 | 34 |
name='nord', |
27 | 35 |
version=versioneer.get_version(), |
28 | 36 |
cmdclass=versioneer.get_cmdclass(), |
29 | 37 |
install_requires=requirements, |
38 |
+ extras_require={ |
|
39 |
+ 'dev': dev_requirements, |
|
40 |
+ }, |
|
30 | 41 |
) |
Versioneer is quite big, but it is the simplest solution in terms
of installation.
Closes #10
... | ... |
@@ -17,12 +17,14 @@ |
17 | 17 |
|
18 | 18 |
from setuptools import setup |
19 | 19 |
|
20 |
+import versioneer |
|
21 |
+ |
|
20 | 22 |
with open('requirements.txt') as r: |
21 | 23 |
requirements = [l.strip() for l in r.readlines()] |
22 | 24 |
|
23 | 25 |
setup( |
24 | 26 |
name='nord', |
25 |
- version='0.1', |
|
26 |
- py_modules=['nord'], |
|
27 |
+ version=versioneer.get_version(), |
|
28 |
+ cmdclass=versioneer.get_cmdclass(), |
|
27 | 29 |
install_requires=requirements, |
28 | 30 |
) |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# |
|
3 |
+# Copyright 2017 Joseph Weston |
|
4 |
+# |
|
5 |
+# This program is free software: you can redistribute it and/or modify |
|
6 |
+# it under the terms of the GNU General Public License as published by |
|
7 |
+# the Free Software Foundation, either version 3 of the License, or |
|
8 |
+# (at your option) any later version. |
|
9 |
+# |
|
10 |
+# This program is distributed in the hope that it will be useful, |
|
11 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+# GNU General Public License for more details. |
|
14 |
+# |
|
15 |
+# You should have received a copy of the GNU General Public License |
|
16 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
+ |
|
18 |
+from setuptools import setup |
|
19 |
+ |
|
20 |
+with open('requirements.txt') as r: |
|
21 |
+ requirements = [l.strip() for l in r.readlines()] |
|
22 |
+ |
|
23 |
+setup( |
|
24 |
+ name='nord', |
|
25 |
+ version='0.1', |
|
26 |
+ py_modules=['nord'], |
|
27 |
+ install_requires=requirements, |
|
28 |
+) |