forked from pydap/pydap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpavement.py
169 lines (149 loc) · 5.21 KB
/
pavement.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import string
from paver.easy import *
from paver.setuputils import setup, find_packages, find_package_data
import paver.doctools
import paver.virtual
from paver.release import setup_meta
try:
from pydap.lib import __version__
except ImportError:
__version__ = ('unknown',)
options = environment.options
setup(**setup_meta)
options(
setup=Bunch(
name='Pydap',
version='.'.join(str(d) for d in __version__),
description='Pure Python Opendap/DODS client and server.',
long_description='''
Pydap is an implementation of the Opendap/DODS protocol, written from
scratch. You can use Pydap to access scientific data on the internet
without having to download it; instead, you work with special array
and iterable objects that download data on-the-fly as necessary, saving
bandwidth and time. The module also comes with a robust-but-lightweight
Opendap server, implemented as a WSGI application.
''',
keywords='opendap dods dap data science climate oceanography meteorology',
classifiers=filter(None, map(string.strip, '''
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Framework :: Paste
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Topic :: Internet
Topic :: Internet :: WWW/HTTP :: WSGI
Topic :: Scientific/Engineering
Topic :: Software Development :: Libraries :: Python Modules
'''.split('\n'))),
author='Roberto De Almeida',
author_email='rob@pydap.org',
url='http://pydap.org/',
license='MIT',
packages=find_packages(),
package_data=find_package_data("pydap", package="pydap",
only_in_packages=False),
include_package_data=True,
zip_safe=False,
namespace_packages=['pydap', 'pydap.responses', 'pydap.handlers', 'pydap.wsgi'],
test_suite='nose.collector',
dependency_links=[],
install_requires=[
'numpy',
'httplib2>=0.4.0',
'Genshi',
'Paste',
'PasteScript',
'PasteDeploy',
],
extras_require={
'test': ['nose', 'wsgi_intercept'],
'docs': ['Paver', 'Sphinx', 'Pygments', 'coards'],
'esgf': ['M2Crypto'],
},
entry_points="""
[pydap.response]
dds = pydap.responses.dds:DDSResponse
das = pydap.responses.das:DASResponse
dods = pydap.responses.dods:DODSResponse
asc = pydap.responses.ascii:ASCIIResponse
ascii = pydap.responses.ascii:ASCIIResponse
ver = pydap.responses.version:VersionResponse
version = pydap.responses.version:VersionResponse
help = pydap.responses.help:HelpResponse
html = pydap.responses.html:HTMLResponse
[paste.app_factory]
server = pydap.wsgi.file:make_app
[paste.paster_create_template]
pydap = pydap.wsgi.templates:DapServerTemplate
""",
),
minilib=Bunch(
extra_files=['doctools', 'virtual'],
versioned_name=True
),
virtualenv=Bunch(
packages_to_install=['Paste', 'Pydap'],
script_name='bootstrap.py',
paver_command_line=None,
install_paver=True
),
sphinx=Bunch(
builddir='_build',
),
cog=Bunch(
includedir='.',
),
deploy=Bunch(
htmldir = path('pydap.org'),
bucket = 'pydap.org',
),
)
if paver.doctools.has_sphinx:
@task
@needs(['cog', 'paver.doctools.html'])
def html():
"""Build the docs and put them into our package."""
destdir = path('pydap.org')
destdir.rmtree()
builtdocs = path("docs") / options.builddir / "html"
builtdocs.move(destdir)
@task
@needs(['cog', 'paver.doctools.doctest'])
def doctest():
pass
if paver.virtual.has_virtualenv:
@task
def bootstrap():
"""Build a virtualenv bootstrap for developing paver."""
paver.virtual._create_bootstrap(options.script_name,
options.packages_to_install,
options.paver_command_line,
options.install_paver)
@task
@needs(['generate_setup', 'setuptools.command.sdist'])
def sdist():
"""Overrides sdist to make sure that our setup.py is generated."""
pass
@task
@cmdopts([
('username=', 'u', 'Username to use when logging in to the servers')
])
def deploy():
"""Deploy the HTML to the server."""
import os
from boto.s3.connection import S3Connection
from boto.s3.key import Key
conn = S3Connection()
bucket = conn.create_bucket(options.bucket)
bucket.set_acl('public-read')
for root, dirs, files in os.walk(options.htmldir):
for file in files:
path = os.path.join(root, file)
k = Key(bucket)
k.key = path[len(options.htmldir)+1:] # strip pydap.org/
k.set_contents_from_filename(path)
k.set_acl('public-read')