summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-09-21 22:53:43 +0200
committerFlorian Bruhin <git@the-compiler.org>2017-09-21 22:54:58 +0200
commitc74236dd96a05829b086f9d8853d1cba3eb606a2 (patch)
tree26aca2d3075b550e5e175d70ecb113d0d60f1789 /setup.py
parent599a5b96482e37b5a8f76bcb73420bb1da8dccce (diff)
downloadqutebrowser-c74236dd96a05829b086f9d8853d1cba3eb606a2.tar.gz
qutebrowser-c74236dd96a05829b086f9d8853d1cba3eb606a2.zip
Move some data from setupcommon to setup.py
We can't get rid of setupcommon entirely (it's needed by PyInstaller), but at least we can get the data back to setup.py. Fixes #2996
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py57
1 files changed, 56 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 7bfd968f6..c90b163ed 100755
--- a/setup.py
+++ b/setup.py
@@ -21,6 +21,8 @@
"""setuptools installer script for qutebrowser."""
+import re
+import ast
import os
import os.path
@@ -35,6 +37,32 @@ except NameError:
BASEDIR = None
+def read_file(name):
+ """Get the string contained in the file named name."""
+ with common.open_file(name, 'r', encoding='utf-8') as f:
+ return f.read()
+
+
+def _get_constant(name):
+ """Read a __magic__ constant from qutebrowser/__init__.py.
+
+ We don't import qutebrowser here because it can go wrong for multiple
+ reasons. Instead we use re/ast to get the value directly from the source
+ file.
+
+ Args:
+ name: The name of the argument to get.
+
+ Return:
+ The value of the argument.
+ """
+ field_re = re.compile(r'__{}__\s+=\s+(.*)'.format(re.escape(name)))
+ path = os.path.join(BASEDIR, 'qutebrowser', '__init__.py')
+ line = field_re.search(read_file(path)).group(1)
+ value = ast.literal_eval(line)
+ return value
+
+
try:
common.write_git_file()
setuptools.setup(
@@ -45,7 +73,34 @@ try:
test_suite='qutebrowser.test',
zip_safe=True,
install_requires=['pypeg2', 'jinja2', 'pygments', 'PyYAML', 'attrs'],
- **common.setupdata
+ name='qutebrowser',
+ version='.'.join(str(e) for e in _get_constant('version_info')),
+ description=_get_constant('description'),
+ long_description=read_file('README.asciidoc'),
+ url='https://www.qutebrowser.org/',
+ requires=['pypeg2', 'jinja2', 'pygments', 'PyYAML', 'attrs'],
+ author=_get_constant('author'),
+ author_email=_get_constant('email'),
+ license=_get_constant('license'),
+ classifiers=[
+ 'Development Status :: 3 - Alpha',
+ 'Environment :: X11 Applications :: Qt',
+ 'Intended Audience :: End Users/Desktop',
+ 'License :: OSI Approved :: GNU General Public License v3 or later '
+ '(GPLv3+)',
+ 'Natural Language :: English',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: Microsoft :: Windows :: Windows XP',
+ 'Operating System :: Microsoft :: Windows :: Windows 7',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Topic :: Internet',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Topic :: Internet :: WWW/HTTP :: Browsers',
+ ],
+ keywords='pyqt browser web qt webkit',
)
finally:
if BASEDIR is not None: