-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
66 lines (56 loc) · 2.39 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
#!/usr/bin/env python
from distutils import log
from distutils.core import setup
from distutils.command.build_scripts import build_scripts
from distutils.command.install_data import install_data
from docutils.core import publish_file
from docutils.writers import manpage
class install_data_man_one(install_data):
def run(self):
# Go through each "directory" entry.
new_data_files = []
for data in self.data_files:
# Skip over files not destined for man1 directories.
if not isinstance(data, tuple) or data[0] != 'share/man/man1':
new_data.append(data)
continue
# Go through the files, and look for *.rst pages.
new_list = []
for entry in data[1]:
# Only process *.rst files.
if not entry.endswith('.rst'):
new_list.append(entry)
continue
# Use docutils to convert the RST document to manpage 1 format.
man = entry[:-4] + '.1'
log.info("converting %s -> %s" % (entry, man))
publish_file(source_path=entry, destination_path=man,
writer=manpage.Writer())
new_list.append(man)
new_data_files.append((data[0], new_list))
# Pass the processed list to the original install_data.run()
self.data_files = new_data_files
install_data.run(self)
class build_scripts_strip_py(build_scripts):
def run(self):
# Process the files list, stripping '.py' from script names.
new_list = []
for script in self.scripts:
if script.endswith('.py'):
self.copy_file(script, script[:-3])
script = script[:-3]
new_list.append(script)
# Pass the processed list to the original build_scripts.run()
self.scripts = new_list
build_scripts.run(self)
setup(name='wavlooper',
version='1.0',
license='GPL-3',
description="Loop a WAV file with optional fadeout.",
author="Ryan \"ZDBioHazard\" Turner",
author_email='[email protected]',
url='https://github.com/ZDBioHazard/wavlooper/',
scripts=['wavlooper.py'],
data_files=[('share/man/man1', ['wavlooper.rst'])],
cmdclass={"build_scripts": build_scripts_strip_py,
"install_data": install_data_man_one})