~dholbach/pkgme/initial-packaging

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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# pkgme - A Debian packaging framework
#
# Copyright (C) 2010 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os

import distribute_setup
distribute_setup.use_setuptools()

from setup_helpers import (
    description, find_doctests, get_version, long_description, require_python)
from setuptools import setup, find_packages


require_python(0x20600f0)
__version__ = get_version('pkgme/__init__.py')

def get_data_files():
    source_dir = os.path.dirname(__file__)
    package_dir = os.path.join(source_dir, "pkgme")
    data_files = []
    base_data_install_dir = os.path.join('share', 'pkgme')

    def install_data_tree(package_subdir):
        source_dir = os.path.join(package_dir, package_subdir)
        target_base_dir = os.path.join(base_data_install_dir, package_subdir)
        for dirpath, dirname, filenames in os.walk(source_dir):
            paths = [os.path.join(dirpath, fn) for fn in filenames]
            target_path = target_base_dir
            relpath = os.path.relpath(dirpath, source_dir)
            if relpath != ".":
                target_path = os.path.join(target_path, relpath)
            data_files.append((target_path, paths))

    install_data_tree("helpers")
    install_data_tree("backends")
    return data_files


setup(
    name='pkgme',
    version=__version__,
    packages=find_packages(),
    include_package_data=True,
    maintainer='pkgme developers',
    maintainer_email='pkgme-devs@lists.launchpad.net',
    description=description('README.txt'),
    long_description=long_description(
        'README.txt',
        'NEWS.txt',
        ),
    license='GPLv3',
    url='http://launchpad.net/pkgme',
    download_url='https://launchpad.net/pkgme/+download',
    test_suite='pkgme.tests',
    install_requires = [
        'argparse',
        'Cheetah',
        'python_debian',
        'fixtures',
        'launchpadlib',
        'Markdown', # "Required" by Cheetah, but only a suggests in the packaging.
        'testtools',
        ],
    entry_points = {
        'console_scripts': ['pkgme=pkgme.bin.main:main'],
        },
    data_files = get_data_files(),
    # Auto-conversion to Python 3.
    use_2to3=True,
    convert_2to3_doctests=find_doctests(),
    )