This repository has been archived by the owner on Oct 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
88 lines (75 loc) · 2.52 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
import os
import subprocess
from setuptools import setup, find_packages
VERSION_NUMBER = "1.1.0"
try:
GIT_BRANCH = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
GIT_BRANCH = GIT_BRANCH.decode() # convert to standard string
GIT_BRANCH = GIT_BRANCH.rstrip() # remove unnecessary whitespace
except Exception as ex:
GIT_BRANCH = "dev"
if GIT_BRANCH == "master":
DEVELOPMENT_STATUS = "Development Status :: 5 - Production/Stable"
VERSION_NAME = VERSION_NUMBER
elif GIT_BRANCH == "beta":
DEVELOPMENT_STATUS = "Development Status :: 4 - Beta"
VERSION_NAME = "%s-beta" % VERSION_NUMBER
elif GIT_BRANCH == "dev":
DEVELOPMENT_STATUS = "Development Status :: 3 - Alpha"
VERSION_NAME = "%s-dev" % VERSION_NUMBER
else:
print("Unknown git branch, using pre-alpha as default")
DEVELOPMENT_STATUS = "Development Status :: 2 - Pre-Alpha"
VERSION_NAME = "%s-%s" % (VERSION_NUMBER, GIT_BRANCH)
def readme_type() -> str:
if os.path.exists("README.rst"):
return "text/x-rst"
if os.path.exists("README.md"):
return "text/markdown"
def readme() -> [str]:
if os.path.exists("README.rst"):
file_name = 'README.rst'
elif os.path.exists("README.md"):
file_name = 'README.md'
else:
return []
with open(file_name) as f:
return f.read()
def read_requirements_file(file_name: str):
with open(file_name, encoding='utf-8') as f:
requirements_file = f.readlines()
return [r.strip() for r in requirements_file]
setup(
name='gopass-chrome-importer',
version=VERSION_NAME,
description='A simple tool to import Chrome passwords into gopass.',
long_description=readme(),
long_description_content_type=readme_type(),
license='MIT',
author='Markus Ressel',
author_email='mail@markusressel.de',
url='https://github.com/markusressel/gopass-chrome-importer',
packages=find_packages(),
classifiers=[
DEVELOPMENT_STATUS,
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
install_requires=[
'click'
],
tests_require=[
'pytest',
'pylint',
'flake8',
],
entry_points={
'console_scripts': [
'gopass-chrome-importer=gopass_chrome_importer.gopass_chrome_importer:cli'
]
}
)