-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
93 lines (85 loc) · 3.46 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- coding: utf-8 -*-
#
# This file was part of lago project.
# This file was part of INSPIRE-SCHEMAS.
# This file is part of autosemver.
# Copyright (C) 2016 CERN.
#
# autosemver is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# autosemver is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with autosemver; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Automatic semantic versioning from git history for python packages"""
import os
from setuptools import setup
IN_A_PACKAGE = False
PKG_INFO = os.path.join(os.path.dirname("__file__"), "PKG-INFO")
if not os.path.exists(PKG_INFO):
from autosemver import PROJECT_NAME
from autosemver.packaging import get_authors, get_changelog, get_current_version
__version__ = get_current_version(project_name=PROJECT_NAME)
else:
IN_A_PACKAGE = True
with open(PKG_INFO) as info_fd:
for line in info_fd.readlines():
if line.startswith("Version: "):
__version__ = line.split(" ", 1)[-1]
break
else:
raise ImportError("Unable to find version for autosemver")
if __name__ == "__main__":
URL = "https://github.com/david-caro/python-autosemver"
LONG_DESCRIPTION = ""
if not IN_A_PACKAGE:
with open("AUTHORS", "w") as authors_fd:
authors_fd.write("\n".join(get_authors()))
with open("CHANGELOG", "w") as changelog_fd:
changelog_fd.write(get_changelog(bugtracker_url=URL + "/issues/"))
README_PATH = os.path.join(os.path.dirname(__file__), "README.rst")
with open(README_PATH, "rb") as readme:
LONG_DESCRIPTION = readme.read().decode("UTF-8")
setup(
author="David Caro",
author_email="[email protected]",
description="Tools to handle automatic semantic versioning in python",
install_requires=["dulwich>=0.19.6"],
long_description=LONG_DESCRIPTION,
long_description_content_type="text/x-rst",
license="GPLv3",
name="autosemver",
package_data={"": ["CHANGELOG", "AUTHORS"]},
packages=["autosemver"],
python_requires=">=3.6",
url=URL,
version=__version__,
entry_points={
"console_scripts": "autosemver=autosemver:main",
"distutils.setup_keywords": [
"autosemver=autosemver:distutils",
"bugtracker_url=autosemver:distutils",
],
},
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
)