]> git.armaanb.net Git - lightcards.git/blob - setup.py
Stop using setuptools data_files for config
[lightcards.git] / setup.py
1 from setuptools import setup
2 import os
3 import shutil
4
5 pwd = os.path.abspath(os.path.dirname(__file__))
6 with open(os.path.join(pwd, "README.md"), encoding="utf-8") as f:
7     long_description = f.read()
8
9
10 def mkdir(dir):
11     try:
12         os.makedirs(dir)
13     except FileExistsError:
14         pass
15
16
17 if os.geteuid() == 0:
18     mkdir("/etc/lightcards/")
19     shutil.copyfile("./config.py", "/etc/lightcards/config.py")
20 else:
21     xdg = os.environ.get("XDG_CONFIG_HOME")
22     home = os.path.expanduser("~")
23
24     if xdg:
25         mkdir(f"{xdg}/lightcards")
26         shutil.copyfile("./config.py", f"{xdg}/lightcards/config.py")
27     else:
28         mkdir(f"{home}/.config/lightcards")
29         shutil.copyfile("./config.py", f"{home}/.config/lightcards/config.py")
30
31
32 setup(
33     name="lightcards",
34     version="0.7.0",
35     description="Terminal flashcards from Markdown",
36     long_description=long_description,
37     long_description_content_type="text/markdown",
38     url="https://sr.ht/~armaan/lightcards",
39     author="Armaan Bhojwani",
40     author_email="me@armaanb.net",
41     license="MIT",
42     packages=["lightcards"],
43     install_requires=["beautifulsoup4", "markdown"],
44     data_files=[
45         ("man/man1", ["man/lightcards.1"]),
46         ("man/man5", ["man/lightcards-config.5"]),
47     ],
48     entry_points={
49         "console_scripts": ["lightcards=lightcards:main"],
50     },
51     classifiers=[
52         "Intended Audience :: Education",
53         "Environment :: Console :: Curses",
54         "License :: OSI Approved :: MIT License",
55         "Topic :: Education",
56     ],
57 )