This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
/
setup.py
83 lines (68 loc) · 2.05 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
#!/usr/bin/env python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from setuptools import setup
import semver
def versioning(version: str) -> str:
"""
version to specification
Author: Huan <[email protected]> (https://github.com/huan)
X.Y.Z -> X.Y.devZ
"""
sem_ver = semver.parse(version)
major = sem_ver['major']
minor = sem_ver['minor']
patch = str(sem_ver['patch'])
if minor % 2:
patch = 'dev' + patch
fin_ver = '%d.%d.%s' % (
major,
minor,
patch,
)
return fin_ver
# Extra __version__ from VERSION instead of pinject.version so pip doen't
# import __init__.py and bump into dependencies that haven't been installed
# yet.
def get_version() -> str:
"""
read version from VERSION file
"""
version = '0.0.0'
with open(
os.path.join(
os.path.dirname(__file__),
'VERSION'
)
) as handle:
# Get X.Y.Z
version = handle.read().strip()
# versioning from X.Y.Z to X.Y.devZ
version = versioning(version)
return version
setup(
name='pinject',
version=get_version(),
description='A pythonic dependency injection library',
author='Kurt Steinkraus',
author_email='[email protected]',
url='https://github.com/google/pinject',
license='Apache License 2.0',
long_description=open('README.rst').read(),
platforms='all',
packages=['pinject'],
install_requires=['six>=1.7.3', 'decorator>=4.3.0'],
)