root/postfacto/trunk/setup.py

Revision 7, 2.9 kB (checked in by fumanchu, 16 months ago)

New 'pf' script, plus setup stuff.

  • Property svn:eol-style set to native
Line 
1"""Installs PostFacto using distutils
2
3Run:
4    python setup.py install
5
6to install this package.
7"""
8
9from distutils.core import setup
10from distutils.command.install import INSTALL_SCHEMES
11import sys
12import os
13import shutil
14
15required_python_version = '2.3'
16
17###############################################################################
18# arguments for the setup command
19###############################################################################
20name = "PostFacto"
21version = "1.0alpha"
22desc = "Version control for Postgresql"
23long_desc = "Post Facto brings Subversion-style version control to PostgreSQL"
24classifiers=[
25    "Development Status :: 3 - Alpha",
26    "Environment :: Console",
27    "Intended Audience :: Developers",
28    "Intended Audience :: System Administrators",
29    "License :: Freely Distributable",
30    "Operating System :: OS Independent",
31    "Programming Language :: Python",
32    "Topic :: Database",
33    "Topic :: Software Development :: Version Control",
34]
35author="Post Facto Team"
36author_email="team@post-facto.org"
37url="http://www.post-facto.org"
38cp_license="BSD"
39packages=[
40    "postfacto", "postfacto.test"
41]
42download_url="http://download.post-facto.org/postfacto/1.0alpha/"
43data_files=[
44    ('postfacto', ['postfacto/LICENSE.txt',
45                  ]),
46]
47###############################################################################
48# end arguments for setup
49###############################################################################
50
51def fix_data_files(data_files):
52    """
53    bdist_wininst seems to have a bug about where it installs data files.
54    I found a fix the django team used to work around the problem at
55    http://code.djangoproject.com/changeset/8313 .  This function
56    re-implements that solution.
57    Also see http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
58    for more info.
59    """
60    def fix_dest_path(path):
61        return '\\PURELIB\\%(path)s' % vars()
62   
63    if not 'bdist_wininst' in sys.argv: return
64   
65    data_files[:] = [
66        (fix_dest_path(path), files)
67        for path, files in data_files]
68fix_data_files(data_files)
69
70def main():
71    if sys.version < required_python_version:
72        s = "I'm sorry, but %s %s requires Python %s or later."
73        print s % (name, version, required_python_version)
74        sys.exit(1)
75    # set default location for "data_files" to
76    # platform specific "site-packages" location
77    for scheme in INSTALL_SCHEMES.values():
78        scheme['data'] = scheme['purelib']
79   
80    dist = setup(
81        name=name,
82        version=version,
83        description=desc,
84        long_description=long_desc,
85        classifiers=classifiers,
86        author=author,
87        author_email=author_email,
88        url=url,
89        license=cp_license,
90        packages=packages,
91        download_url=download_url,
92        data_files=data_files,
93        scripts=[os.path.join("postfacto", "pf.py")],
94    )
95
96
97if __name__ == "__main__":
98    main()
Note: See TracBrowser for help on using the browser.