Install now with expanded symlinks for those platforms that don't support them.
diff --git a/Makefile b/Makefile
index 0c2eeaa..e88e4d1 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,11 @@
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 @@
@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
diff --git a/bin/enable-app-engine-project b/bin/enable-app-engine-project
old mode 100644
new mode 100755
index 07dfb7b..8a53ec2
--- a/bin/enable-app-engine-project
+++ b/bin/enable-app-engine-project
@@ -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('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 @@
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 @@
# 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 @@
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))
diff --git a/expand-symlinks.py b/expand-symlinks.py
new file mode 100644
index 0000000..29535d6
--- /dev/null
+++ b/expand-symlinks.py
@@ -0,0 +1,3 @@
+from distutils.dir_util import copy_tree
+
+copy_tree('.', 'snapshot', verbose=True)
diff --git a/samples/appengine/oauth2client b/samples/appengine/oauth2client
new file mode 120000
index 0000000..9013119
--- /dev/null
+++ b/samples/appengine/oauth2client
@@ -0,0 +1 @@
+../../oauth2client/
\ No newline at end of file
diff --git a/samples/oauth2/appengine/apiclient b/samples/oauth2/appengine/apiclient
deleted file mode 120000
index f53af07..0000000
--- a/samples/oauth2/appengine/apiclient
+++ /dev/null
@@ -1 +0,0 @@
-../../../apiclient/
\ No newline at end of file
diff --git a/samples/oauth2/appengine/app.yaml b/samples/oauth2/appengine/app.yaml
deleted file mode 100644
index 03bdf81..0000000
--- a/samples/oauth2/appengine/app.yaml
+++ /dev/null
@@ -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
-
diff --git a/samples/oauth2/appengine/gflags.py b/samples/oauth2/appengine/gflags.py
deleted file mode 120000
index 157177e..0000000
--- a/samples/oauth2/appengine/gflags.py
+++ /dev/null
@@ -1 +0,0 @@
-../../../gflags.py
\ No newline at end of file
diff --git a/samples/oauth2/appengine/gflags_validators.py b/samples/oauth2/appengine/gflags_validators.py
deleted file mode 120000
index 9d359e0..0000000
--- a/samples/oauth2/appengine/gflags_validators.py
+++ /dev/null
@@ -1 +0,0 @@
-../../../gflags_validators.py
\ No newline at end of file
diff --git a/samples/oauth2/appengine/httplib2 b/samples/oauth2/appengine/httplib2
deleted file mode 120000
index 69b02ef..0000000
--- a/samples/oauth2/appengine/httplib2
+++ /dev/null
@@ -1 +0,0 @@
-../../../httplib2/
\ No newline at end of file
diff --git a/samples/oauth2/appengine/index.yaml b/samples/oauth2/appengine/index.yaml
deleted file mode 100644
index a3b9e05..0000000
--- a/samples/oauth2/appengine/index.yaml
+++ /dev/null
@@ -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.
diff --git a/samples/oauth2/appengine/main.py b/samples/oauth2/appengine/main.py
deleted file mode 100644
index 087a136..0000000
--- a/samples/oauth2/appengine/main.py
+++ /dev/null
@@ -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()
diff --git a/samples/oauth2/appengine/oauth2client b/samples/oauth2/appengine/oauth2client
deleted file mode 120000
index 0a1ec33..0000000
--- a/samples/oauth2/appengine/oauth2client
+++ /dev/null
@@ -1 +0,0 @@
-../../../oauth2client/
\ No newline at end of file
diff --git a/samples/oauth2/appengine/simplejson b/samples/oauth2/appengine/simplejson
deleted file mode 120000
index eeaa2f0..0000000
--- a/samples/oauth2/appengine/simplejson
+++ /dev/null
@@ -1 +0,0 @@
-../../../simplejson/
\ No newline at end of file
diff --git a/samples/oauth2/appengine/uritemplate b/samples/oauth2/appengine/uritemplate
deleted file mode 120000
index 5952908..0000000
--- a/samples/oauth2/appengine/uritemplate
+++ /dev/null
@@ -1 +0,0 @@
-../../../uritemplate/
\ No newline at end of file
diff --git a/samples/oauth2/appengine/welcome.html b/samples/oauth2/appengine/welcome.html
deleted file mode 100644
index da40a16..0000000
--- a/samples/oauth2/appengine/welcome.html
+++ /dev/null
@@ -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>