-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move webutil to oauth_dropins.webutil. it's a bit presumptuous to put it at the top level when it's named so broadly. * switch gdata-python-client from submodule to pip dependency. (i've submitted my two bug fix patches as google/gdata-python-client#27.) * move appengine_config.py to oauth_dropins, except for vender/virtualenv setup * update README
- Loading branch information
Showing
9 changed files
with
127 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/build/ | ||
/dist/ | ||
/.eggs/ | ||
/*.egg-info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[submodule "gdata-python-client"] | ||
path = gdata-python-client | ||
url = [email protected]:snarfed/gdata-python-client.git | ||
[submodule "webutil"] | ||
path = webutil | ||
path = oauth_dropins/webutil | ||
url = [email protected]:snarfed/webutil.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,7 @@ | ||
"""App Engine settings. | ||
from oauth_dropins.appengine_config import * | ||
|
||
Reads app keys and secrets into constants from these files: | ||
disqus_client_id | ||
disqus_client_secret | ||
dropbox_app_key | ||
dropbox_app_secret | ||
facebook_app_id | ||
facebook_app_secret | ||
facebook_app_id_local | ||
facebook_app_secret_local | ||
flickr_app_key | ||
flickr_app_secret | ||
google_client_id | ||
google_client_secret | ||
instagram_client_id | ||
instagram_client_secret | ||
instagram_client_id_local | ||
instagram_client_secret_local | ||
twitter_app_key | ||
twitter_app_secret | ||
tumblr_app_key | ||
tumblr_app_secret | ||
wordpress_client_id | ||
wordpress_client_secret | ||
wordpress_client_id_local | ||
wordpress_client_secret_local | ||
""" | ||
|
||
import os | ||
import sys | ||
|
||
# Load packages in lib/ | ||
# Load packages from virtualenv | ||
# https://cloud.google.com/appengine/docs/python/tools/libraries27#vendoring | ||
from google.appengine.ext import vendor | ||
vendor.add('local') | ||
|
||
from webutil.appengine_config import * | ||
|
||
# default timeout. the G+ and Instagram APIs use httplib2, which honors this. | ||
import socket | ||
socket.setdefaulttimeout(HTTP_TIMEOUT) | ||
# monkey-patch socket.getdefaulttimeout() because it often gets reset, e.g. by | ||
# socket.setblocking() and maybe other operations. | ||
# http://stackoverflow.com/a/8465202/186123 | ||
socket.getdefaulttimeout = lambda: HTTP_TIMEOUT | ||
|
||
# Add submodule directories to sys.path so they can be imported. | ||
# | ||
# I used to use symlinks and munge sys.modules, but both of those ended up in | ||
# duplicate instances of modules, which caused problems. Background in | ||
# https://github.com/snarfed/bridgy/issues/31 | ||
for path in ( | ||
'gdata-python-client/src', | ||
): | ||
path = os.path.join(os.path.dirname(__file__), path) | ||
if path not in sys.path: | ||
sys.path.append(path) | ||
|
||
|
||
def read(filename): | ||
"""Returns the contents of filename, or None if it doesn't exist.""" | ||
if os.path.exists(filename): | ||
with open(filename) as f: | ||
return f.read().strip() | ||
|
||
MOCKFACEBOOK = False | ||
|
||
if DEBUG: | ||
FACEBOOK_APP_ID = read('facebook_app_id_local') | ||
FACEBOOK_APP_SECRET = read('facebook_app_secret_local') | ||
INSTAGRAM_CLIENT_ID = read('instagram_client_id_local') | ||
INSTAGRAM_CLIENT_SECRET = read('instagram_client_secret_local') | ||
WORDPRESS_CLIENT_ID = read('wordpress.com_client_id_local') | ||
WORDPRESS_CLIENT_SECRET = read('wordpress.com_client_secret_local') | ||
DISQUS_CLIENT_ID = read('disqus_client_id_local') | ||
DISQUS_CLIENT_SECRET = read('disqus_client_secret_local') | ||
else: | ||
FACEBOOK_APP_ID = read('facebook_app_id') | ||
FACEBOOK_APP_SECRET = read('facebook_app_secret') | ||
INSTAGRAM_CLIENT_ID = read('instagram_client_id') | ||
INSTAGRAM_CLIENT_SECRET = read('instagram_client_secret') | ||
WORDPRESS_CLIENT_ID = read('wordpress.com_client_id') | ||
WORDPRESS_CLIENT_SECRET = read('wordpress.com_client_secret') | ||
DISQUS_CLIENT_ID = read('disqus_client_id') | ||
DISQUS_CLIENT_SECRET = read('disqus_client_secret') | ||
|
||
DROPBOX_APP_KEY = read('dropbox_app_key') | ||
DROPBOX_APP_SECRET = read('dropbox_app_secret') | ||
FLICKR_APP_KEY = read('flickr_app_key') | ||
FLICKR_APP_SECRET = read('flickr_app_secret') | ||
GOOGLE_CLIENT_ID = read('google_client_id') | ||
GOOGLE_CLIENT_SECRET = read('google_client_secret') | ||
TUMBLR_APP_KEY = read('tumblr_app_key') | ||
TUMBLR_APP_SECRET = read('tumblr_app_secret') | ||
TWITTER_APP_KEY = read('twitter_app_key') | ||
TWITTER_APP_SECRET = read('twitter_app_secret') |
Submodule gdata-python-client
deleted from
fabb62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
"""App Engine settings. | ||
Reads app keys and secrets into constants from these files: | ||
disqus_client_id | ||
disqus_client_secret | ||
dropbox_app_key | ||
dropbox_app_secret | ||
facebook_app_id | ||
facebook_app_secret | ||
facebook_app_id_local | ||
facebook_app_secret_local | ||
flickr_app_key | ||
flickr_app_secret | ||
google_client_id | ||
google_client_secret | ||
instagram_client_id | ||
instagram_client_secret | ||
instagram_client_id_local | ||
instagram_client_secret_local | ||
twitter_app_key | ||
twitter_app_secret | ||
tumblr_app_key | ||
tumblr_app_secret | ||
wordpress_client_id | ||
wordpress_client_secret | ||
wordpress_client_id_local | ||
wordpress_client_secret_local | ||
""" | ||
|
||
import os | ||
|
||
from webutil.appengine_config import * | ||
|
||
# default timeout. the G+ and Instagram APIs use httplib2, which honors this. | ||
import socket | ||
socket.setdefaulttimeout(HTTP_TIMEOUT) | ||
# monkey-patch socket.getdefaulttimeout() because it often gets reset, e.g. by | ||
# socket.setblocking() and maybe other operations. | ||
# http://stackoverflow.com/a/8465202/186123 | ||
socket.getdefaulttimeout = lambda: HTTP_TIMEOUT | ||
|
||
|
||
def read(filename): | ||
"""Returns the contents of filename, or None if it doesn't exist.""" | ||
if os.path.exists(filename): | ||
with open(filename) as f: | ||
return f.read().strip() | ||
|
||
if DEBUG: | ||
FACEBOOK_APP_ID = read('facebook_app_id_local') | ||
FACEBOOK_APP_SECRET = read('facebook_app_secret_local') | ||
INSTAGRAM_CLIENT_ID = read('instagram_client_id_local') | ||
INSTAGRAM_CLIENT_SECRET = read('instagram_client_secret_local') | ||
WORDPRESS_CLIENT_ID = read('wordpress.com_client_id_local') | ||
WORDPRESS_CLIENT_SECRET = read('wordpress.com_client_secret_local') | ||
DISQUS_CLIENT_ID = read('disqus_client_id_local') | ||
DISQUS_CLIENT_SECRET = read('disqus_client_secret_local') | ||
else: | ||
FACEBOOK_APP_ID = read('facebook_app_id') | ||
FACEBOOK_APP_SECRET = read('facebook_app_secret') | ||
INSTAGRAM_CLIENT_ID = read('instagram_client_id') | ||
INSTAGRAM_CLIENT_SECRET = read('instagram_client_secret') | ||
WORDPRESS_CLIENT_ID = read('wordpress.com_client_id') | ||
WORDPRESS_CLIENT_SECRET = read('wordpress.com_client_secret') | ||
DISQUS_CLIENT_ID = read('disqus_client_id') | ||
DISQUS_CLIENT_SECRET = read('disqus_client_secret') | ||
|
||
DROPBOX_APP_KEY = read('dropbox_app_key') | ||
DROPBOX_APP_SECRET = read('dropbox_app_secret') | ||
FLICKR_APP_KEY = read('flickr_app_key') | ||
FLICKR_APP_SECRET = read('flickr_app_secret') | ||
GOOGLE_CLIENT_ID = read('google_client_id') | ||
GOOGLE_CLIENT_SECRET = read('google_client_secret') | ||
TUMBLR_APP_KEY = read('tumblr_app_key') | ||
TUMBLR_APP_SECRET = read('tumblr_app_secret') | ||
TWITTER_APP_KEY = read('twitter_app_key') | ||
TWITTER_APP_SECRET = read('twitter_app_secret') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule webutil
updated
from 000000 to 39bdb2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,22 +6,15 @@ | |
Based on https://github.com/pypa/sampleproject/blob/master/setup.py | ||
""" | ||
import unittest | ||
|
||
from setuptools import setup | ||
|
||
|
||
class TestLoader(unittest.TestLoader): | ||
def loadTestsFromNames(self, names, _=None): | ||
return self.discover(names[0]) | ||
from setuptools import setup, find_packages | ||
|
||
|
||
setup(name='oauth-dropins', | ||
version='1.0', | ||
description='Drop-in App Engine OAuth client handlers for many popular sites.', | ||
long_description=open('README.rst').read(), | ||
url='https://github.com/snarfed/oauth-dropins', | ||
packages=['oauth_dropins', 'webutil'], | ||
packages=find_packages(), | ||
author='Ryan Barrett', | ||
author_email='[email protected]', | ||
license='Public domain', | ||
|
@@ -36,6 +29,7 @@ def loadTestsFromNames(self, names, _=None): | |
], | ||
keywords='oauth appengine', | ||
install_requires=[ | ||
'gdata', | ||
'google-api-python-client', | ||
'httplib2', | ||
'oauthlib', | ||
|
@@ -44,6 +38,5 @@ def loadTestsFromNames(self, names, _=None): | |
'requests-oauthlib', | ||
'tweepy', | ||
], | ||
test_loader='setup:TestLoader', | ||
test_suite='.', | ||
test_suite='oauth_dropins', | ||
) |
c936b72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @kylewm, you've done more pypi packaging than me before (read: any :P). i think i have a decent rough draft in the current repo right now. mind skimming it and see what you think? tia!
c936b72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(btw, it currently needs snarfed/webutil#2 for the tests to run. not sure what the actually right fix is yet. meh.)
c936b72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun!
This looks pretty good. You may want to exclude test classes in the find_packages call (I think
find_packages(exclude="test")
).Also when you read in README.rst, you can use this if you'd like
https://github.com/kylewm/brevity/blob/master/setup.py#L8
The codecs thing is necessary if the environment variable LANG=C and the readme file contains unicode. The path, I don't exactly remember why I needed to add it, something about virtualenvs I think.
c936b72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for looking! both great ideas, i'll definitely add them.