-
Notifications
You must be signed in to change notification settings - Fork 21
/
setup.py
86 lines (70 loc) · 2.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
from setuptools import setup, find_packages
from setuptools.command.install import install
import os
from lyrics import __version__, CONFIG_PATH
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
class PostInstallConfigUpdate(install):
"""Post-installation for config update"""
def run(self):
install.run(self)
self.updateConfigFile()
def updateConfigFile(self):
if CONFIG_PATH.exists():
from configparser import ConfigParser
old_config = ConfigParser()
old_config.read(CONFIG_PATH)
new_config = ConfigParser()
new_config.read('lyrics/lyrics.cfg')
skip = True
for section in old_config.sections():
old_keys = {o for o in old_config[section]}
new_keys = {n for n in new_config[section]}
changes = new_keys ^ old_keys
if len(changes) == 0:
continue
else:
skip = False
for option in new_keys:
fallback = new_config[section].get(option)
new_config[section][option] = old_config[section].get(option, fallback)
if not skip:
with open(CONFIG_PATH, 'w') as file:
new_config.write(file)
setup(
name='lyrics-in-terminal',
version=__version__,
description='Command Line Lyrics fetcher from mpris media player like Spotify, VLC, Audacious',
author='Samarth Jugran',
author_email='jugransamarth@gmail.com',
license='MIT',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/Jugran/lyrics-in-terminal',
packages=find_packages(),
entry_points={
'console_scripts': [
'lyrics = lyrics.lyrics_in_terminal:main',
'lyt = lyrics.lyrics_in_terminal:main'
]
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
],
install_requires=[
'dbus-python',
'requests'
],
extras_require={
'mpd': ['python-mpd2'],
'full': ['python-mpd2']
},
python_requires='>=3.7',
cmdclass={
'install': PostInstallConfigUpdate
},
include_package_data=True
)