~t-w-/backtestground/backtestground

33 by Thorsten Wilms
Add ez_setup.
1
import ez_setup
2
ez_setup.use_setuptools()
3
27 by Thorsten Wilms
Make installable via setup.py.
4
import os
5
from os.path import isdir
6
from setuptools import setup
159 by Thorsten Wilms
setup.py: guard against empty elements in data_files.
7
27 by Thorsten Wilms
Make installable via setup.py.
8
160 by Thorsten Wilms
setup.py: get_files(path) instead of explicit lists.
9
def get_files(path):
10
    """List files with relative path."""
11
    file_names = os.listdir(path)
12
    file_paths = map(lambda x: ''.join([path, '/', x]), file_names)
13
14
    return file_paths
15
16
27 by Thorsten Wilms
Make installable via setup.py.
17
def read(fname):
160 by Thorsten Wilms
setup.py: get_files(path) instead of explicit lists.
18
    """Utility function to read the README file."""
19
27 by Thorsten Wilms
Make installable via setup.py.
20
    return open(os.path.join(os.path.dirname(__file__), fname)).read()
21
160 by Thorsten Wilms
setup.py: get_files(path) instead of explicit lists.
22
27 by Thorsten Wilms
Make installable via setup.py.
23
# Only install templates if ~/Templates exists
24
home = os.getenv("HOME")
147 by Thorsten Wilms
setup.py: update.
25
templates = ''.join([home, '/Templates'])
27 by Thorsten Wilms
Make installable via setup.py.
26
27
if isdir(templates):
164 by Thorsten Wilms
Use utility dir for bits and pieces.
28
    template_files = (templates, get_files('templates/'))
148 by Thorsten Wilms
Take care of man page installation.
29
else:
30
    template_files = ''
31
32
# Man pages
33
man_path = '/usr/local/man/man1'
34
35
if isdir(man_path):
160 by Thorsten Wilms
setup.py: get_files(path) instead of explicit lists.
36
    man_files = (man_path, get_files('man/'))
148 by Thorsten Wilms
Take care of man page installation.
37
else:
38
    man_files = ''
39
159 by Thorsten Wilms
setup.py: guard against empty elements in data_files.
40
# data_files may not contain empty elements
41
data_files = filter(lambda x: x, [template_files, man_files])
27 by Thorsten Wilms
Make installable via setup.py.
42
43
44
setup(
148 by Thorsten Wilms
Take care of man page installation.
45
    name="Backtestground",
151 by Thorsten Wilms
Increase version number in anticipation of 0.4 (forget to do it for 0.3).
46
    version="0.4",
148 by Thorsten Wilms
Take care of man page installation.
47
    author="Thorsten Wilms",
48
    author_email="t_w_@freenet.de",
49
    description=("A collection of templates and utilities for the creation "
159 by Thorsten Wilms
setup.py: guard against empty elements in data_files.
50
                 "and evaluation of desktop backgrounds (wallpapers)."),
148 by Thorsten Wilms
Take care of man page installation.
51
    license="GPLv3",
52
    keywords="background wallpaper images utility templates",
53
    url="https://launchpad.net/backtestground",
27 by Thorsten Wilms
Make installable via setup.py.
54
    long_description=read('docs/README'),
55
    classifiers=[
56
        "Development Status :: 4 - Beta",
57
        "Environment :: Console",
58
        "Intended Audience :: Other Audience",
59
        "License :: OSI Approved :: GNU General Public License (GPL)",
60
        "Natural Language :: English",
61
        "Operating System :: POSIX",
62
        "Programming Language :: Python",
63
        "Topic :: Multimedia :: Graphics :: Graphics Conversion",
64
        "Topic :: Utilities"],
65
    zip_safe=True,
149 by Thorsten Wilms
Fix module handling.
66
    package_dir={'':'lib'},
67
    packages=['backtestground'],
160 by Thorsten Wilms
setup.py: get_files(path) instead of explicit lists.
68
    scripts=get_files('bin/'),
32 by Thorsten Wilms
setup.py: get rid of entry_points, rely on script to get a working installation without duplicates.
69
    data_files=data_files
27 by Thorsten Wilms
Make installable via setup.py.
70
)