-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
33 lines (24 loc) · 785 Bytes
/
setup.py
File metadata and controls
33 lines (24 loc) · 785 Bytes
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
#!/usr/bin/python3
import os
import warnings
from setuptools import setup
# Nice big warning
WARNING_TMPL = """File {filename} is not present! Try running 'make' first.
MISSING FILE: {filename}
This data file is not present or is not readable, so it has not been
included in the distribution.
"""
FILE_SPEC = [("share/man/man1", ["data/galleryviewer.1.gz"])]
def data_files(file_spec):
for dest_dir, files in file_spec:
readable = []
for filename in files:
if os.access(filename, os.R_OK):
readable.append(filename)
else:
warnings.warn(WARNING_TMPL.format(filename=filename))
if readable:
yield (dest_dir, readable)
setup(
data_files=list(data_files(FILE_SPEC))
)