| 1 |
"""Installs CherryPy using distutils |
|---|
| 2 |
|
|---|
| 3 |
Run: |
|---|
| 4 |
python setup.py install |
|---|
| 5 |
|
|---|
| 6 |
to install this package. |
|---|
| 7 |
""" |
|---|
| 8 |
|
|---|
| 9 |
try: |
|---|
| 10 |
from setuptools import setup |
|---|
| 11 |
except ImportError: |
|---|
| 12 |
from distutils.core import setup |
|---|
| 13 |
|
|---|
| 14 |
from distutils.command.install import INSTALL_SCHEMES |
|---|
| 15 |
import sys |
|---|
| 16 |
import os |
|---|
| 17 |
import shutil |
|---|
| 18 |
|
|---|
| 19 |
required_python_version = '2.3' |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
name = "CherryPy" |
|---|
| 25 |
version = "3.2.0rc1" |
|---|
| 26 |
desc = "Object-Oriented HTTP framework" |
|---|
| 27 |
long_desc = "CherryPy is a pythonic, object-oriented HTTP framework" |
|---|
| 28 |
classifiers=[ |
|---|
| 29 |
|
|---|
| 30 |
"Development Status :: 4 - Beta", |
|---|
| 31 |
"Environment :: Web Environment", |
|---|
| 32 |
"Intended Audience :: Developers", |
|---|
| 33 |
"License :: Freely Distributable", |
|---|
| 34 |
"Operating System :: OS Independent", |
|---|
| 35 |
"Programming Language :: Python", |
|---|
| 36 |
"Topic :: Internet :: WWW/HTTP :: Dynamic Content", |
|---|
| 37 |
"Topic :: Software Development :: Libraries :: Application Frameworks", |
|---|
| 38 |
] |
|---|
| 39 |
author="CherryPy Team" |
|---|
| 40 |
author_email="team@cherrypy.org" |
|---|
| 41 |
url="http://www.cherrypy.org" |
|---|
| 42 |
cp_license="BSD" |
|---|
| 43 |
packages=[ |
|---|
| 44 |
"cherrypy", "cherrypy.lib", |
|---|
| 45 |
"cherrypy.tutorial", "cherrypy.test", |
|---|
| 46 |
"cherrypy.wsgiserver", "cherrypy.process", |
|---|
| 47 |
"cherrypy.scaffold", |
|---|
| 48 |
] |
|---|
| 49 |
download_url="http://download.cherrypy.org/cherrypy/3.2.0/" |
|---|
| 50 |
data_files=[ |
|---|
| 51 |
('cherrypy', ['cherrypy/cherryd', |
|---|
| 52 |
'cherrypy/favicon.ico', |
|---|
| 53 |
'cherrypy/LICENSE.txt', |
|---|
| 54 |
]), |
|---|
| 55 |
('cherrypy/process', []), |
|---|
| 56 |
('cherrypy/scaffold', ['cherrypy/scaffold/example.conf', |
|---|
| 57 |
'cherrypy/scaffold/site.conf', |
|---|
| 58 |
]), |
|---|
| 59 |
('cherrypy/scaffold/static', ['cherrypy/scaffold/static/made_with_cherrypy_small.png', |
|---|
| 60 |
]), |
|---|
| 61 |
('cherrypy/test', ['cherrypy/test/style.css', |
|---|
| 62 |
'cherrypy/test/test.pem', |
|---|
| 63 |
]), |
|---|
| 64 |
('cherrypy/test/static', ['cherrypy/test/static/index.html', |
|---|
| 65 |
'cherrypy/test/static/dirback.jpg',]), |
|---|
| 66 |
('cherrypy/tutorial', |
|---|
| 67 |
[ |
|---|
| 68 |
'cherrypy/tutorial/tutorial.conf', |
|---|
| 69 |
'cherrypy/tutorial/README.txt', |
|---|
| 70 |
'cherrypy/tutorial/pdf_file.pdf', |
|---|
| 71 |
'cherrypy/tutorial/custom_error.html', |
|---|
| 72 |
] |
|---|
| 73 |
), |
|---|
| 74 |
] |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
def fix_data_files(data_files): |
|---|
| 80 |
""" |
|---|
| 81 |
bdist_wininst seems to have a bug about where it installs data files. |
|---|
| 82 |
I found a fix the django team used to work around the problem at |
|---|
| 83 |
http://code.djangoproject.com/changeset/8313 . This function |
|---|
| 84 |
re-implements that solution. |
|---|
| 85 |
Also see http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html |
|---|
| 86 |
for more info. |
|---|
| 87 |
""" |
|---|
| 88 |
def fix_dest_path(path): |
|---|
| 89 |
return '\\PURELIB\\%(path)s' % vars() |
|---|
| 90 |
|
|---|
| 91 |
if not 'bdist_wininst' in sys.argv: return |
|---|
| 92 |
|
|---|
| 93 |
data_files[:] = [ |
|---|
| 94 |
(fix_dest_path(path), files) |
|---|
| 95 |
for path, files in data_files] |
|---|
| 96 |
fix_data_files(data_files) |
|---|
| 97 |
|
|---|
| 98 |
def main(): |
|---|
| 99 |
if sys.version < required_python_version: |
|---|
| 100 |
s = "I'm sorry, but %s %s requires Python %s or later." |
|---|
| 101 |
print s % (name, version, required_python_version) |
|---|
| 102 |
sys.exit(1) |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
for scheme in INSTALL_SCHEMES.values(): |
|---|
| 106 |
scheme['data'] = scheme['purelib'] |
|---|
| 107 |
|
|---|
| 108 |
dist = setup( |
|---|
| 109 |
name=name, |
|---|
| 110 |
version=version, |
|---|
| 111 |
description=desc, |
|---|
| 112 |
long_description=long_desc, |
|---|
| 113 |
classifiers=classifiers, |
|---|
| 114 |
author=author, |
|---|
| 115 |
author_email=author_email, |
|---|
| 116 |
url=url, |
|---|
| 117 |
license=cp_license, |
|---|
| 118 |
packages=packages, |
|---|
| 119 |
download_url=download_url, |
|---|
| 120 |
data_files=data_files, |
|---|
| 121 |
scripts=[os.path.join("cherrypy", "cherryd")], |
|---|
| 122 |
) |
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
if __name__ == "__main__": |
|---|
| 126 |
main() |
|---|