| 1 | """Installs PostFacto using distutils |
|---|
| 2 | |
|---|
| 3 | Run: |
|---|
| 4 | python setup.py install |
|---|
| 5 | |
|---|
| 6 | to install this package. |
|---|
| 7 | """ |
|---|
| 8 | |
|---|
| 9 | from distutils.core import setup |
|---|
| 10 | from distutils.command.install import INSTALL_SCHEMES |
|---|
| 11 | import sys |
|---|
| 12 | import os |
|---|
| 13 | import shutil |
|---|
| 14 | |
|---|
| 15 | required_python_version = '2.3' |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | name = "PostFacto" |
|---|
| 21 | version = "1.0alpha" |
|---|
| 22 | desc = "Version control for Postgresql" |
|---|
| 23 | long_desc = "Post Facto brings Subversion-style version control to PostgreSQL" |
|---|
| 24 | classifiers=[ |
|---|
| 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 | ] |
|---|
| 35 | author="Post Facto Team" |
|---|
| 36 | author_email="team@post-facto.org" |
|---|
| 37 | url="http://www.post-facto.org" |
|---|
| 38 | cp_license="BSD" |
|---|
| 39 | packages=[ |
|---|
| 40 | "postfacto", "postfacto.test" |
|---|
| 41 | ] |
|---|
| 42 | download_url="http://download.post-facto.org/postfacto/1.0alpha/" |
|---|
| 43 | data_files=[ |
|---|
| 44 | ('postfacto', ['postfacto/LICENSE.txt', |
|---|
| 45 | ]), |
|---|
| 46 | ] |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | def 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] |
|---|
| 68 | fix_data_files(data_files) |
|---|
| 69 | |
|---|
| 70 | def 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 | |
|---|
| 76 | |
|---|
| 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 | |
|---|
| 97 | if __name__ == "__main__": |
|---|
| 98 | main() |
|---|