Eclectic Media Git toast / 2572c55
Removed setup.py sphinx stuff for easier pip Ariana Giroux 9 months ago
2 changed file(s) with 0 addition(s) and 114 deletion(s). Raw diff Collapse all Expand all
1616 python3 -m pip install .
1717
1818 .. note:: You may need to install the BurntToast_ powershell executable. To do so, run "Install-Module -Name BurntToast" (with administrator privilleges)
19
20 Installing the Manpages
21 -----------------------
22
23 An ease of use command has been added to ``setup.py``, allowing you to simply
24 run:
25 ::
26
27 python3 setup.py install_docs
28
29 .. note:: You can uninstall the docs with ``setup.py`` via ``uninstall_docs``
30
31 Building the Manpages
32 =====================
33
34 A convienience function has been added to ``setup.py``, allowing you to compile
35 the docs with:
36 ::
37
38 python3 setup.py build_sphinx
39
40 .. note:: built pages located under ``docs/build/man``
41
42 .. note:: to view the manpages directly after compile, use ``python3 setup.py docs``.
43
44 ----
45
46 Consult the manpages for more information
47
48 .. _BurntToast: https://github.com/Windos/BurntToast
49 .. _repository: git-server:arianagiroux/toast.git
5019
5120
5221 Contributing to the Project
00 from setuptools import setup, find_packages
11 from distutils.cmd import Command
2 from sphinx.setup_command import BuildDoc
32 from sys import executable
43 from os import system, access, F_OK
54
109
1110 with open("requirements.txt", "r") as f:
1211 required = f.read().splitlines()
13
14
15 class Docs(Command):
16 user_options = [
17 ('manpage=', None, 'The man page section you want to view (likely 5)'),
18 ('compile', None, 'Force recompile of the docs'),
19 ]
20
21 def initialize_options(self):
22 self.manpage = '1'
23 self.compile = False
24
25 def finalize_options(self):
26 try:
27 int(self.manpage)
28 except ValueError:
29 print('--manpage must be an int between 1 and 8')
30 exit(1)
31
32 def run(self):
33 if not access('docs/build/man', F_OK) or self.compile:
34 self.announce('Compiling docs...', level=4)
35 system('%s setup.py build_sphinx' % executable)
36
37 if self.manpage == '':
38 system('man ./docs/build/man/toast.1')
39 else:
40 system('man ./docs/build/man/toast.%s' % self.manpage)
41
42
43 class InstallDocs(Command):
44 user_options = [
45 ('system-wide', None, 'Install pages system wide'),
46 ]
47
48 def initialize_options(self):
49 self.system_wide = False
50
51 def finalize_options(self):
52 pass
53
54 def run(self):
55 self.announce('Compiling docs...')
56 system('%s setup.py build_sphinx' % executable)
57 self.announce('Installing docs')
58 system('mkdir -p ~/.local/man/man1 ~/.local/man/man5')
59 system('cp docs/build/man/toast.1 ~/.local/man/man1/')
60 system('cp docs/build/man/toast.5 ~/.local/man/man5/')
61 system('mandb')
62
63
64 class UninstallDocs(Command):
65 user_options = [
66 ('system-wide', None, 'Install pages system wide'),
67 ]
68
69 def initialize_options(self):
70 self.system_wide = False
71
72 def finalize_options(self):
73 pass
74
75 def run(self):
76 self.announce('Uninstalling manpages')
77 system('rm ~/.local/man/man1/toast.1')
78 system('rm ~/.local/man/man5/toast.5')
79 system('mandb')
80
8112
8213 version = __version__
8314 setup(
9829 entry_points={
9930 'console_scripts': ['toast=toast.__main__'],
10031 },
101 cmdclass={
102 'build_sphinx': BuildDoc,
103 'docs': Docs,
104 'install_docs': InstallDocs,
105 'uninstall_docs': UninstallDocs,
106 },
107 command_options={
108 'build_sphinx': {
109 'project': ('setup.py', 'toast'),
110 'version': ('setup.py', str(__version__)),
111 'source_dir': ('setup.py', 'docs'),
112 'build_dir': ('setup.py', 'docs/build'),
113 'builder': ('setup.py', 'man'),
114 }},
11532 classifiers=(
11633 "Programming Language :: Python :: 3",
11734 "License :: OSI Approved :: MIT License",