-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
53 lines (41 loc) · 1.2 KB
/
setup.py
File metadata and controls
53 lines (41 loc) · 1.2 KB
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
# -*- coding: utf-8 -*-
import io
import ast
from re import compile
from setuptools import setup
def _get_version():
version_re = compile(r"__version__\s+=\s+(.*)")
with open("up2b2.py", "rb") as fh:
version = ast.literal_eval(
version_re.search(fh.read().decode("utf-8")).group(1)
)
return str(version)
def _get_author():
author_re = compile(r"__author__\s+=\s+(.*)")
mail_re = compile(r"(.*)\s<(.*)>")
with open("up2b2.py", "rb") as fh:
author = ast.literal_eval(
author_re.search(fh.read().decode("utf-8")).group(1)
)
mail = mail_re.search(author)
return (mail.group(1), mail.group(2)) if mail else (author, None)
def _get_readme():
with io.open("README.rst", "rt", encoding="utf8") as f:
return f.read()
version = _get_version()
(author, email) = _get_author()
setup(
name="up2b2",
version=version,
license="Apache 2.0",
author=author,
author_email=email,
description="Save uploaded pictures in Backblaze B2.",
long_description=_get_readme(),
url="https://github.com/sapicd/up2b2",
py_modules=[
"up2b2",
],
zip_safe=False,
install_requires=["b2sdk>=1.21.0"],
)