Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

root/tags/cherrypy-2.2.0rc1/setup.py

Revision 1000 (checked in by rdelon, 3 years ago)

Preparing for 2.2.0rc1 release

Line 
1 """Installs CherryPy 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 # arguments for the setup command
19 ###############################################################################
20 name = "CherryPy"
21 version = "2.2.0rc1"
22 desc = "Object-Oriented web development framework"
23 long_desc = "CherryPy is a pythonic, object-oriented web development framework"
24 classifiers=[
25     #"Development Status :: 5 - Production/Stable",
26     "Development Status :: 4 - Beta",
27     "Intended Audience :: Developers",
28     "License :: Freely Distributable",
29     "Programming Language :: Python",
30     "Topic :: Internet ",
31     "Topic :: Software Development :: Libraries :: Application Frameworks",
32 ]
33 author="CherryPy Team"
34 author_email="team@cherrypy.org"
35 url="http://www.cherrypy.org"
36 cp_license="BSD"
37 packages=[
38     "cherrypy", "cherrypy.lib", "cherrypy.lib.filter",
39     "cherrypy.tutorial", "cherrypy.test", "cherrypy.filters",
40 ]
41 download_url="http://sourceforge.net/project/showfiles.php?group_id=56099"
42 data_files=[
43     ('cherrypy/tutorial',
44         [
45             'cherrypy/tutorial/tutorial.conf',
46             'cherrypy/tutorial/README.txt',
47             'cherrypy/tutorial/pdf_file.pdf',
48             'cherrypy/tutorial/custom_error.html',
49         ]
50     ),
51     ('cherrypy', ['cherrypy/favicon.ico',]),
52     ('cherrypy/test', ['cherrypy/test/style.css',]),
53     ('cherrypy/test/static', ['cherrypy/test/static/index.html',
54                               'cherrypy/test/static/has space.html',]),
55 ]
56 ###############################################################################
57 # end arguments for setup
58 ###############################################################################
59
60
61 def main():
62     if sys.version < required_python_version:
63         s = "I'm sorry, but %s %s requires Python %s or later."
64         print s % (name, version, required_python_version)
65         sys.exit(1)
66     # set default location for "data_files" to platform specific "site-packages"
67     # location
68     for scheme in INSTALL_SCHEMES.values():
69         scheme['data'] = scheme['purelib']
70
71     dist = setup(
72         name=name,
73         version=version,
74         description=desc,
75         long_description=long_desc,
76         classifiers=classifiers,
77         author=author,
78         author_email=author_email,
79         url=url,
80         license=cp_license,
81         packages=packages,
82         download_url=download_url,
83         data_files=data_files,
84     )
85
86     # the code in the following "if" block handles situations where the
87     # user has installed over an older release of 2.1 with a conflicting
88     # version of the sessionfilter
89     if 'install_lib' in dist.command_obj:
90        
91         # get the installation directory (is there a better way to do this?)
92         install_dir = dist.command_obj['install_lib'].install_dir
93
94         # make sure we have an absolute install path
95         install_dir = os.path.join(os.path.abspath('/'), install_dir)
96        
97         old_session_filter_path = os.path.join(
98             install_dir, 'cherrypy', 'lib', 'filter', 'sessionfilter')
99        
100         # check for existence of old sessionfilter package dir
101         # and prompt the user if it exists
102         if os.path.exists(old_session_filter_path):
103             handle_old_session_filter(old_session_filter_path)
104
105        
106 def handle_old_session_filter(pth):
107     warn_old_session_filter(pth)
108     choice = raw_input('Delete old sessionfilter directory? (yes/no): ')
109     if choice.lower() in ('y', 'yes'):
110         shutil.rmtree(pth)
111         print "Old sessionfilter directory deleted."
112     else:
113         print "You will need to manually need to delete the old sessionfilter directory."
114
115
116 def warn_old_session_filter(pth):
117     msg = """
118 ************************ WARNING *****************************
119  Since you have installed over the top of an existing CherryPy
120  installation, you must remove the old sessionfilter package
121  directory at:
122  %s
123 ************************ WARNING *****************************
124 """ % (pth,)
125     print msg
126    
127
128 if __name__ == "__main__":
129     main()
Note: See TracBrowser for help on using the browser.

Hosted by WebFaction

Log in as guest/cpguest to create tickets