From 45ab49a2e55405c5d23157adacf00a24e441de51 Mon Sep 17 00:00:00 2001 From: james sangho nah Date: Thu, 23 Mar 2017 14:04:47 +1300 Subject: [PATCH 1/3] Tidy up indentation --- setup.py | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/setup.py b/setup.py index b427154..cdb031f 100644 --- a/setup.py +++ b/setup.py @@ -58,26 +58,26 @@ ] REMOTE_MAVEN_PACKAGES = [ - # (group id, artifact id, version), - ('com.amazonaws', 'amazon-kinesis-client', '1.7.2'), - ('com.amazonaws', 'aws-java-sdk-dynamodb', '1.11.14'), - ('com.amazonaws', 'aws-java-sdk-s3', '1.11.14'), - ('com.amazonaws', 'aws-java-sdk-kms', '1.11.14'), - ('com.amazonaws', 'aws-java-sdk-core', '1.11.14'), - ('commons-logging', 'commons-logging', '1.1.3'), - ('org.apache.httpcomponents', 'httpclient', '4.5.2'), - ('org.apache.httpcomponents', 'httpcore', '4.4.4'), - ('commons-codec', 'commons-codec', '1.9'), - ('com.fasterxml.jackson.core', 'jackson-databind', '2.6.6'), - ('com.fasterxml.jackson.core', 'jackson-annotations', '2.6.0'), - ('com.fasterxml.jackson.core', 'jackson-core', '2.6.6'), - ('com.fasterxml.jackson.dataformat', 'jackson-dataformat-cbor', '2.6.6'), - ('joda-time', 'joda-time', '2.8.1'), - ('com.amazonaws', 'aws-java-sdk-kinesis', '1.11.14'), - ('com.amazonaws', 'aws-java-sdk-cloudwatch', '1.11.14'), - ('com.google.guava', 'guava', '18.0'), - ('com.google.protobuf', 'protobuf-java', '2.6.1'), - ('commons-lang', 'commons-lang', '2.6') + # (group id, artifact id, version), + ('com.amazonaws', 'amazon-kinesis-client', '1.7.2'), + ('com.amazonaws', 'aws-java-sdk-dynamodb', '1.11.14'), + ('com.amazonaws', 'aws-java-sdk-s3', '1.11.14'), + ('com.amazonaws', 'aws-java-sdk-kms', '1.11.14'), + ('com.amazonaws', 'aws-java-sdk-core', '1.11.14'), + ('commons-logging', 'commons-logging', '1.1.3'), + ('org.apache.httpcomponents', 'httpclient', '4.5.2'), + ('org.apache.httpcomponents', 'httpcore', '4.4.4'), + ('commons-codec', 'commons-codec', '1.9'), + ('com.fasterxml.jackson.core', 'jackson-databind', '2.6.6'), + ('com.fasterxml.jackson.core', 'jackson-annotations', '2.6.0'), + ('com.fasterxml.jackson.core', 'jackson-core', '2.6.6'), + ('com.fasterxml.jackson.dataformat', 'jackson-dataformat-cbor', '2.6.6'), + ('joda-time', 'joda-time', '2.8.1'), + ('com.amazonaws', 'aws-java-sdk-kinesis', '1.11.14'), + ('com.amazonaws', 'aws-java-sdk-cloudwatch', '1.11.14'), + ('com.google.guava', 'guava', '18.0'), + ('com.google.protobuf', 'protobuf-java', '2.6.1'), + ('commons-lang', 'commons-lang', '2.6') ] @@ -127,11 +127,12 @@ def package_url(self, group_id, artifact_id, version): # prefix = 'http://search.maven.org/remotecontent?filepath=' return '{prefix}{path}/{artifact_id}/{version}/{dest}'.format( - prefix=prefix, - path='/'.join(group_id.split('.')), - artifact_id=artifact_id, - version=version, - dest=self.package_destination(artifact_id, version)) + prefix=prefix, + path='/'.join(group_id.split('.')), + artifact_id=artifact_id, + version=version, + dest=self.package_destination(artifact_id, version) + ) def download_file(self, url, dest): """ @@ -251,4 +252,4 @@ def run(self): url="https://github.com/awslabs/amazon-kinesis-client-python", keywords="amazon kinesis client library python", zip_safe=False, - ) + ) From fe2c39ea0d80e9e8be3837a7bf7850334824c5fd Mon Sep 17 00:00:00 2001 From: james sangho nah Date: Thu, 23 Mar 2017 14:05:45 +1300 Subject: [PATCH 2/3] Minor cleanups --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index cdb031f..d8c4f1b 100644 --- a/setup.py +++ b/setup.py @@ -81,7 +81,7 @@ ] -class MavenJarDownloader: +class MavenJarDownloader(object): def __init__(self, on_completion, destdir=JAR_DIRECTORY, packages=REMOTE_MAVEN_PACKAGES): self.on_completion = on_completion @@ -170,7 +170,7 @@ def run(self): """ Runs when this command is given to setup.py """ - downloader = MavenJarDownloader(on_completion=lambda : None) + downloader = MavenJarDownloader(on_completion=lambda: None) downloader.download_files() print(''' Now you should run: From 8ddac81e2ba95b84a8badda588ba4bd5f9f06db2 Mon Sep 17 00:00:00 2001 From: james sangho nah Date: Thu, 23 Mar 2017 14:09:12 +1300 Subject: [PATCH 3/3] Use safer defaults for kwargs --- setup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index d8c4f1b..dddc641 100644 --- a/setup.py +++ b/setup.py @@ -83,12 +83,15 @@ class MavenJarDownloader(object): - def __init__(self, on_completion, destdir=JAR_DIRECTORY, packages=REMOTE_MAVEN_PACKAGES): + def __init__(self, on_completion, destdir=JAR_DIRECTORY, packages=None): self.on_completion = on_completion self.destdir = destdir - self.packages = packages + self.packages = packages or REMOTE_MAVEN_PACKAGES + + def warning_string(self, missing_jars=None): + if not missing_jars: + return "" - def warning_string(self, missing_jars=[]): s = '''The following jars were not installed because they were not present in this package at the time of installation:''' for jar in missing_jars: