Skip to content

Commit b515474

Browse files
authored
Updated to KCL 2.1.2 with SDK 2.4.0 (#92)
Updated the dependency script to handle classifiers Maven has an additional field call classifier which allow artifacts to vary. One of the KCL dependencies includes a classifier so the dependencies script has been updated to support that.
1 parent cb45813 commit b515474

File tree

2 files changed

+68
-30
lines changed

2 files changed

+68
-30
lines changed

scripts/build_deps.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# permissions and limitations under the License.
1414
"""
1515
Builds the dependency list used by setup.py from the maven dependency tree. This script must be run in the
16-
amazon-kinesis-client directory, or where the pom.xml for the amazon-kinesis-client is available.
16+
amazon-kinesis-client or amazon-kinesis-client-multilang directory, or where the pom.xml for the libraries are present.
1717
"""
1818
import subprocess
1919
from tempfile import mkstemp
@@ -22,14 +22,52 @@
2222

2323

2424
def format_dependency(line):
25-
match = re.match(r'^[\\\s+|-]*(?P<group_id>[^:]+):(?P<artifact_id>[^:]+):[^:]+:(?P<version>[^:\s]+)', line)
25+
"""
26+
This attempts to extract Maven dependencies and versions from a line of output from mvn dependency:tree
27+
28+
An example line without specifiers:
29+
30+
``[INFO] +- software.amazon.kinesis:amazon-kinesis-client:jar:2.1.2:compile``
31+
32+
This fields in the line in order are:
33+
1. Group Id: software.amazon.kinesis
34+
2. Artifact Id: amazon-kinesis-client
35+
3. Packaging: jar (not used)
36+
4. Version: 2.1.2
37+
5. Dependency type: compile (this will be runtime or compile)
38+
39+
An example line with specifiers:
40+
41+
``[INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.32.Final:compile``
42+
43+
The fields in order are:
44+
1. Group Id: io.netty
45+
2. Artifact Id: netty-transport-native-epoll
46+
3. Packaging: jar (not used)
47+
4. Specifier: linux-x86_64 (not used)
48+
5. Version: 4.1.32.Final
49+
6. Dependency type: compile (this will be runtime or compile)
50+
51+
:param str line: the line to extract version information from
52+
:return: the version information needed to retrieve the jars from Maven Central
53+
"""
54+
match = re.match(r'^[\\\s+|-]*(?P<dep_line>[^\s]+)', line)
2655
assert match is not None
27-
return "('{group_id}', '{artifact_id}', '{version}')".format(group_id=match.groupdict()['group_id'],
28-
artifact_id=match.groupdict()['artifact_id'],
29-
version=match.groupdict()['version'])
56+
items = match.groupdict()['dep_line'].split(":")
57+
version_idx = 3
58+
if len(items) > 5:
59+
version_idx = 4
60+
61+
return "('{group_id}', '{artifact_id}', '{version}')".format(group_id=items[0],
62+
artifact_id=items[1],
63+
version=items[version_idx])
3064

3165

3266
def build_deps():
67+
"""
68+
Extracts all the dependencies from the pom.xml and formats them into a form usable for setup.py or other
69+
multilang daemon implementations
70+
"""
3371
(fh, filename) = mkstemp()
3472
close(fh)
3573
output_command = '-Doutput={temp}'.format(temp=filename)

setup.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,23 @@
5050

5151
PACKAGE_NAME = 'amazon_kclpy'
5252
JAR_DIRECTORY = os.path.join(PACKAGE_NAME, 'jars')
53-
PACKAGE_VERSION = '2.0.0'
53+
PACKAGE_VERSION = '2.0.1'
5454
PYTHON_REQUIREMENTS = [
5555
'boto',
5656
# argparse is part of python2.7 but must be declared for python2.6
5757
'argparse',
5858
]
5959
REMOTE_MAVEN_PACKAGES = [
6060
# (group id, artifact id, version),
61-
('software.amazon.kinesis', 'amazon-kinesis-client-multilang', '2.1.0'),
62-
('software.amazon.kinesis', 'amazon-kinesis-client', '2.1.0'),
63-
('software.amazon.awssdk', 'kinesis', '2.2.0'),
64-
('software.amazon.awssdk', 'aws-cbor-protocol', '2.2.0'),
65-
('com.fasterxml.jackson.dataformat', 'jackson-dataformat-cbor', '2.9.7'),
66-
('software.amazon.awssdk', 'aws-json-protocol', '2.2.0'),
67-
('software.amazon.awssdk', 'dynamodb', '2.2.0'),
68-
('software.amazon.awssdk', 'cloudwatch', '2.2.0'),
69-
('software.amazon.awssdk', 'netty-nio-client', '2.2.0'),
61+
('software.amazon.kinesis', 'amazon-kinesis-client-multilang', '2.1.2'),
62+
('software.amazon.kinesis', 'amazon-kinesis-client', '2.1.2'),
63+
('software.amazon.awssdk', 'kinesis', '2.4.0'),
64+
('software.amazon.awssdk', 'aws-cbor-protocol', '2.4.0'),
65+
('com.fasterxml.jackson.dataformat', 'jackson-dataformat-cbor', '2.9.8'),
66+
('software.amazon.awssdk', 'aws-json-protocol', '2.4.0'),
67+
('software.amazon.awssdk', 'dynamodb', '2.4.0'),
68+
('software.amazon.awssdk', 'cloudwatch', '2.4.0'),
69+
('software.amazon.awssdk', 'netty-nio-client', '2.4.0'),
7070
('io.netty', 'netty-codec-http', '4.1.32.Final'),
7171
('io.netty', 'netty-codec-http2', '4.1.32.Final'),
7272
('io.netty', 'netty-codec', '4.1.32.Final'),
@@ -90,22 +90,22 @@
9090
('org.apache.commons', 'commons-lang3', '3.8.1'),
9191
('org.slf4j', 'slf4j-api', '1.7.25'),
9292
('io.reactivex.rxjava2', 'rxjava', '2.1.14'),
93-
('software.amazon.awssdk', 'sts', '2.2.0'),
94-
('software.amazon.awssdk', 'aws-query-protocol', '2.2.0'),
95-
('software.amazon.awssdk', 'protocol-core', '2.2.0'),
96-
('software.amazon.awssdk', 'profiles', '2.2.0'),
97-
('software.amazon.awssdk', 'sdk-core', '2.2.0'),
98-
('com.fasterxml.jackson.core', 'jackson-core', '2.9.7'),
99-
('com.fasterxml.jackson.core', 'jackson-databind', '2.9.7'),
100-
('software.amazon.awssdk', 'auth', '2.2.0'),
93+
('software.amazon.awssdk', 'sts', '2.4.0'),
94+
('software.amazon.awssdk', 'aws-query-protocol', '2.4.0'),
95+
('software.amazon.awssdk', 'protocol-core', '2.4.0'),
96+
('software.amazon.awssdk', 'profiles', '2.4.0'),
97+
('software.amazon.awssdk', 'sdk-core', '2.4.0'),
98+
('com.fasterxml.jackson.core', 'jackson-core', '2.9.8'),
99+
('com.fasterxml.jackson.core', 'jackson-databind', '2.9.8'),
100+
('software.amazon.awssdk', 'auth', '2.4.0'),
101101
('software.amazon', 'flow', '1.7'),
102-
('software.amazon.awssdk', 'http-client-spi', '2.2.0'),
103-
('software.amazon.awssdk', 'regions', '2.2.0'),
104-
('com.fasterxml.jackson.core', 'jackson-annotations', '2.9.7'),
105-
('software.amazon.awssdk', 'annotations', '2.2.0'),
106-
('software.amazon.awssdk', 'utils', '2.2.0'),
107-
('software.amazon.awssdk', 'aws-core', '2.2.0'),
108-
('software.amazon.awssdk', 'apache-client', '2.2.0'),
102+
('software.amazon.awssdk', 'http-client-spi', '2.4.0'),
103+
('software.amazon.awssdk', 'regions', '2.4.0'),
104+
('com.fasterxml.jackson.core', 'jackson-annotations', '2.9.0'),
105+
('software.amazon.awssdk', 'annotations', '2.4.0'),
106+
('software.amazon.awssdk', 'utils', '2.4.0'),
107+
('software.amazon.awssdk', 'aws-core', '2.4.0'),
108+
('software.amazon.awssdk', 'apache-client', '2.4.0'),
109109
('org.apache.httpcomponents', 'httpclient', '4.5.6'),
110110
('commons-codec', 'commons-codec', '1.10'),
111111
('org.apache.httpcomponents', 'httpcore', '4.4.10'),

0 commit comments

Comments
 (0)