summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-19 19:14:55 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-19 19:14:55 +0100
commit21b20116f5872490bfbba4cf9cbdc8410a8a1d7d (patch)
tree1e094bcf2594ca5566b6214931342172268bc9bc /setup.py
parentcbfce386d236877556df6d3d7d184e9285ab9708 (diff)
downloadqutebrowser-21b20116f5872490bfbba4cf9cbdc8410a8a1d7d.tar.gz
qutebrowser-21b20116f5872490bfbba4cf9cbdc8410a8a1d7d.zip
Go back to a normal setup.py
For some reason, despite using "find:" for the package and this working fine for the sdist, the qutebrowser-git Archlinux package doesn't actually include any qutebrowser/ files anymore. This currently really doesn't seem to be worth the trouble... See #3526 This reverts commit 90323d1d9854dec2382f36e8cfb7c632e18bc97b. This reverts commit 21ee2fe8825cd74f5bce4b1c90f597011feb3a8a.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py70
1 files changed, 69 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 55a5b9157..9b9057201 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,9 +37,75 @@ 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() # data is in setup.cfg
+ setuptools.setup(
+ packages=setuptools.find_packages(exclude=['scripts', 'scripts.*']),
+ include_package_data=True,
+ entry_points={'gui_scripts':
+ ['qutebrowser = qutebrowser.qutebrowser:main']},
+ zip_safe=True,
+ install_requires=['jinja2', 'PyYAML',
+ 'dataclasses; python_version < "3.7"',
+ 'importlib_resources>=1.1.0; python_version < "3.9"'],
+ python_requires='>=3.6',
+ name='qutebrowser',
+ version=_get_constant('version'),
+ description=_get_constant('description'),
+ long_description=read_file('README.asciidoc'),
+ long_description_content_type='text/plain',
+ url='https://www.qutebrowser.org/',
+ author=_get_constant('author'),
+ author_email=_get_constant('email'),
+ license=_get_constant('license'),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ '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 :: POSIX :: Linux',
+ 'Operating System :: MacOS',
+ 'Operating System :: POSIX :: BSD',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Topic :: Internet',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Topic :: Internet :: WWW/HTTP :: Browsers',
+ ],
+ keywords='pyqt browser web qt webkit qtwebkit qtwebengine',
+ )
finally:
if BASEDIR is not None:
path = os.path.join(BASEDIR, 'qutebrowser', 'git-commit-id')