forked from liamks/libpytunes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
71 lines (60 loc) · 2.07 KB
/
setup.py
File metadata and controls
71 lines (60 loc) · 2.07 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding: utf-8 -*-
"""File Information
@file_name: setup.py
@author: Dylan "dyl-m" Monfret
Setup for deployment
"""
import setuptools
import shutil
import subprocess
def get_version_from_git():
"""Retrieve package version from git tag name.
@return: package version.
"""
git_path = shutil.which("git")
if git_path is None:
raise EnvironmentError("Git is not installed or not found in PATH.")
try:
version = (
subprocess.run([git_path, "describe", "--tags"],
check=True,
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
)
return version.split('-')[0]
except subprocess.CalledProcessError as error:
raise RuntimeError(f"Failed to get version from git: {error}")
def parse_requirements():
"""Load requirements from a pip requirements file and return them as a list
@return: dependencies with compatibility symbol changed
"""
with open('requirements.txt', 'r', encoding='utf-8') as f:
return [line.strip().replace('~=', '>=')
for line in f if line.strip() and not line.startswith("#")]
setuptools.setup(
name='libpybee',
version=get_version_from_git(),
author='Dylan "dyl-m" Monfret',
author_email="dyl_m.dev@proton.me",
description='MusicBee Library Parser in Python (based on Liam Kaufman\'s "libpytunes")',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
url="https://github.com/Dyl-M/libpybee",
packages=setuptools.find_packages(),
package_data={"libpybee": ["VERSION"]},
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.8",
entry_points={"console_scripts": ["libpybee = libpybee.main:main"]},
install_requires=parse_requirements(),
extras_require={
"dev": [
"flakes",
"pytest",
"pytest-cov"
]
}
)