|
| 1 | +import io |
| 2 | +import os |
1 | 3 | import re
|
2 |
| -from os.path import abspath, dirname, join |
3 | 4 |
|
4 | 5 | from setuptools import find_packages, setup
|
5 | 6 |
|
6 | 7 |
|
7 | 8 | VERSION_RE = re.compile(r"__version__\s*=\s*\"(.*?)\"")
|
| 9 | +HERE = os.path.abspath(os.path.dirname(__file__)) |
8 | 10 |
|
9 | 11 |
|
10 |
| -def readme(): |
11 |
| - with open(abspath("README.md")) as f: |
12 |
| - return f.read() |
| 12 | +def read(*args): |
| 13 | + """Reads complete file contents.""" |
| 14 | + return io.open(os.path.join(HERE, *args), encoding="utf-8").read() |
13 | 15 |
|
14 | 16 |
|
15 |
| -current_path = abspath(dirname(__file__)) |
| 17 | +def get_version(): |
| 18 | + """Reads the version from this module.""" |
| 19 | + init = read("pygitguardian", "__init__.py") |
| 20 | + return VERSION_RE.search(init).group(1) |
16 | 21 |
|
17 |
| -with open(join(current_path, "pygitguardian", "__init__.py")) as file: |
18 |
| - content = file.read() |
19 |
| - result = re.search(VERSION_RE, content) |
20 |
| - if result is None: |
21 |
| - raise Exception("could not find package version") |
22 |
| - __version__ = result.group(1) |
23 | 22 |
|
24 | 23 | setup(
|
25 | 24 | name="pygitguardian",
|
26 |
| - version=__version__, |
| 25 | + version=get_version(), |
27 | 26 | packages=find_packages(exclude=["tests"]),
|
28 |
| - description=readme(), |
29 |
| - install_requires=["marshmallow>=3.5", "requests>=2"], |
30 |
| - include_package_data=True, |
| 27 | + description="Python Wrapper for GitGuardian's API -- Scan security policy breaks everywhere", |
| 28 | + long_description=read("README.md"), |
| 29 | + long_description_content_type="text/markdown", |
| 30 | + url="https://github.com/GitGuardian/py-gitguardian", |
31 | 31 | author="GitGuardian",
|
32 | 32 |
|
| 33 | + maintainer="GitGuardian", |
| 34 | + install_requires=["marshmallow>=3.5", "requests>=2"], |
| 35 | + include_package_data=True, |
33 | 36 | zip_safe=True,
|
| 37 | + license="MIT", |
| 38 | + keywords="api-client devsecops secrets-detection security-tools library gitguardian", |
| 39 | + classifiers=[ |
| 40 | + "Development Status :: 5 - Production/Stable", |
| 41 | + "Intended Audience :: Developers", |
| 42 | + "Natural Language :: English", |
| 43 | + "License :: OSI Approved :: MIT License", |
| 44 | + "Programming Language :: Python", |
| 45 | + "Programming Language :: Python :: 3", |
| 46 | + "Programming Language :: Python :: 3.4", |
| 47 | + "Programming Language :: Python :: 3.5", |
| 48 | + "Programming Language :: Python :: 3.6", |
| 49 | + "Programming Language :: Python :: 3.7", |
| 50 | + "Operating System :: OS Independent", |
| 51 | + "Topic :: Security", |
| 52 | + ], |
34 | 53 | )
|
0 commit comments