Install now with expanded symlinks for those platforms that don't support them.

This commit is contained in:
Joe Gregorio
2011-04-05 01:31:55 -04:00
parent bce596b4c5
commit b17c7636f6
15 changed files with 33 additions and 183 deletions

View File

@@ -14,9 +14,11 @@ prerelease:
python2.4 runtests.py tests --exit_on_failure
python2.6 runtests.py tests --exit_on_failure
python2.7 runtests.py tests --exit_on_failure
-rm -rf dist/*
python setup.py clean
python setup.py sdist --formats=gztar,zip
-sudo rm -rf dist/
-sudo rm -rf snapshot/
python expand-symlinks.py
cd snapshot; python setup.py clean
cd snapshot; python setup.py sdist --formats=gztar,zip
.PHONY: release
release: prerelease
@@ -24,7 +26,7 @@ release: prerelease
@echo "Are you sure you want to proceed? (yes/no)"
@read yn; [ "yes" == $$yn ]
@echo "Here we go..."
python setup.py sdist --formats=gztar,zip register upload
cd snapshot; python setup.py sdist --formats=gztar,zip register upload
wget "http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py" -O googlecode_upload.py
python googlecode_upload.py --summary="Version $(shell python setup.py --version)" --project=google-api-python-client dist/*.tar.gz
python googlecode_upload.py --summary="Version $(shell python setup.py --version)" --project=google-api-python-client dist/*.zip
python googlecode_upload.py --summary="Version $(shell python setup.py --version)" --project=google-api-python-client snapshot/dist/*.tar.gz
python googlecode_upload.py --summary="Version $(shell python setup.py --version)" --project=google-api-python-client snapshot/dist/*.zip

26
bin/enable-app-engine-project Normal file → Executable file
View File

@@ -16,9 +16,12 @@
"""Copy the sources for google-api-python-client into an App Engine project.
Copies, or symbolically links the sources of the google-api-python-client
Copies the sources of the google-api-python-client
library into a Google App Engine project. This is necessary so that the
source can be uploaded when the application is deployed.
$ enable-app-engine-project [flags] directory
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
@@ -53,6 +56,15 @@ gflags.DEFINE_boolean('force', 'False',
gflags.DEFINE_boolean('dry_run', 'False', 'Don\'t actually do anything.')
def find_source(module):
"""Find the absolute path for the source of a module.
Args:
module: str, Name of the module.
Returns:
A tuple of (isdir, location), a boolean indicating if it
is a directory (True) or a single file module (False), and
the absolute path of the source.
"""
isdir = False
location = ''
m = __import__(module)
@@ -71,7 +83,11 @@ def main(argv):
try:
argv = FLAGS(argv)
except gflags.FlagsError, e:
print '%s\\nUsage: %s ARGS\\n%s' % (e, argv[0], FLAGS)
print '%s\nUsage: %s ARGS\n%s' % (e, argv[0], FLAGS)
sys.exit(1)
if len(argv) == 1:
print 'Usage: %s ARGS\n%s' % (argv[0], FLAGS)
sys.exit(1)
# Set the logging according to the command-line flag
@@ -82,7 +98,7 @@ def main(argv):
# Check if the supplied directory is an App Engine project by looking
# for an app.yaml
if not os.path.isfile(os.path.join(dir, 'app.yaml')):
sys.exit('The given directory is not a Google App Engine project: %s', dir)
sys.exit('The given directory is not a Google App Engine project: %s' % dir)
# Build up the set of file or directory copying actions we need to do
@@ -105,10 +121,10 @@ def main(argv):
if isdir:
results = copy_tree(src, dst, FLAGS.dry_run)
for filename in results:
logging.info('Copied to: %s' % filename)
print 'Copied: %s' % filename
else:
filename, copied = copy_file(src, dst, FLAGS.dry_run)
logging.info('Copied to: %s Successfully: %s' % (filename, copied))
print 'Copied: %s Successfully: %s' % (filename, copied)
except DistutilsFileError, e:
sys.exit(str(e))

3
expand-symlinks.py Normal file
View File

@@ -0,0 +1,3 @@
from distutils.dir_util import copy_tree
copy_tree('.', 'snapshot', verbose=True)

View File

@@ -0,0 +1 @@
../../oauth2client/

View File

@@ -1 +0,0 @@
../../../apiclient/

View File

@@ -1,16 +0,0 @@
application: m-buzz
version: 1
runtime: python
api_version: 1
handlers:
- url: /static
static_dir: static
- url: /google8f1adb368b7bd14c.html
upload: google8f1adb368b7bd14c.html
static_files: static/google8f1adb368b7bd14c.html
- url: .*
script: main.py

View File

@@ -1 +0,0 @@
../../../gflags.py

View File

@@ -1 +0,0 @@
../../../gflags_validators.py

View File

@@ -1 +0,0 @@
../../../httplib2/

View File

@@ -1,11 +0,0 @@
indexes:
# AUTOGENERATED
# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

View File

@@ -1,109 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import httplib2
import logging
import os
import pickle
from apiclient.discovery import build
from oauth2client.appengine import CredentialsProperty
from oauth2client.appengine import StorageByKeyName
from oauth2client.client import OAuth2WebServerFlow
from google.appengine.api import memcache
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp.util import login_required
class Credentials(db.Model):
credentials = CredentialsProperty()
class MainHandler(webapp.RequestHandler):
@login_required
def get(self):
user = users.get_current_user()
credentials = StorageByKeyName(
Credentials, user.user_id(), 'credentials').get()
if credentials is None or credentials.invalid == True:
flow = OAuth2WebServerFlow(
# Visit https://code.google.com/apis/console to
# generate your client_id, client_secret and to
# register your redirect_uri.
client_id='<YOUR CLIENT ID HERE>',
client_secret='<YOUR CLIENT SECRET HERE>',
scope='https://www.googleapis.com/auth/buzz',
user_agent='buzz-cmdline-sample/1.0',
domain='anonymous',
xoauth_displayname='Google App Engine Example App')
callback = self.request.relative_url('/auth_return')
authorize_url = flow.step1_get_authorize_url(callback)
memcache.set(user.user_id(), pickle.dumps(flow))
self.redirect(authorize_url)
else:
http = httplib2.Http()
http = credentials.authorize(http)
service = build("buzz", "v1", http=http)
activities = service.activities()
activitylist = activities.list(scope='@consumption',
userId='@me').execute()
path = os.path.join(os.path.dirname(__file__), 'welcome.html')
logout = users.create_logout_url('/')
self.response.out.write(
template.render(
path, {'activitylist': activitylist,
'logout': logout
}))
class OAuthHandler(webapp.RequestHandler):
@login_required
def get(self):
user = users.get_current_user()
flow = pickle.loads(memcache.get(user.user_id()))
if flow:
credentials = flow.step2_exchange(self.request.params)
StorageByKeyName(
Credentials, user.user_id(), 'credentials').put(credentials)
self.redirect("/")
else:
pass
def main():
application = webapp.WSGIApplication(
[
('/', MainHandler),
('/auth_return', OAuthHandler)
],
debug=True)
util.run_wsgi_app(application)
if __name__ == '__main__':
main()

View File

@@ -1 +0,0 @@
../../../oauth2client/

View File

@@ -1 +0,0 @@
../../../simplejson/

View File

@@ -1 +0,0 @@
../../../uritemplate/

View File

@@ -1,29 +0,0 @@
<html>
<head>
<title>Buzz Stuff</title>
<style type=text/css>
td { vertical-align: top; padding: 0.5em }
img { border:0 }
</style>
</head>
<body>
<p><a href="{{ logout }}">Logout</a></p>
<table border=0>
{% for item in activitylist.items %}
<tr valign=top>
<td>
<a href="{{ item.actor.profileUrl }}"><img
src="{{ item.actor.thumbnailUrl }}"></a><br>
<a href="{{ item.actor.profileUrl }}">{{ item.actor.name }}</a></td>
<td>
{{ item.object.content }}
</td>
<td>
<a href="{{ item.object.links.alternate.0.href }}"><img
src="/static/go.png"></a>
</td>
</tr>
{% endfor %}
</table>
</body>
</html>