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

root/tags/cherrypy-2.1.0/setup.py

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

Preparing for 2.1.0 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.1.0"
22 desc = "Object-Oriented web development framework"
23 long_desc = "CherryPy is a pythonic, object-oriented web development framework"
24 classifiers=[
25     "Development Status :: Stable",
26     "Intended Audience :: Developers",
27     "License :: Freely Distributable",
28     "Programming Language :: Python",
29     "Topic :: Internet ",
30     "Topic :: Software Development :: Libraries :: Application Frameworks",
31 ]
32 author="CherryPy Team"
33 author_email="team@cherrypy.org"
34 url="http://www.cherrypy.org"
35 cp_license="BSD"
36 packages=[
37     "cherrypy", "cherrypy.lib", "cherrypy.lib.filter",
38     "cherrypy.tutorial", "cherrypy.test",
39 ]
40 download_url="http://sourceforge.net/project/showfiles.php?group_id=56099"
41 data_files=[
42     ('cherrypy/tutorial',
43         [
44             'cherrypy/tutorial/tutorial.conf',
45             'cherrypy/tutorial/README.txt',
46             'cherrypy/tutorial/pdf_file.pdf',
47             'cherrypy/tutorial/custom_error.html',
48         ]
49     ),
50     ('cherrypy', ['cherrypy/favicon.ico',]),
51     ('cherrypy/test', ['cherrypy/test/style.css',]),
52     ('cherrypy/test/static', ['cherrypy/test/static/index.html',
53                               'cherrypy/test/static/has space.html',]),
54 ]
55 ###############################################################################
56 # end arguments for setup
57 ###############################################################################
58
59
60 def main():
61     if sys.version < required_python_version:
62         s = "I'm sorry, but %s %s requires Python %s or later."
63         print s % (name, version, required_python_version)
64         sys.exit(1)
65
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