Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a57a70d

Browse files
committed
fix installation of JARs in amazon_kclpy
1 parent 6581153 commit a57a70d

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

‎Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,33 @@ usage: ## Show this help
88
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
99

1010
install: ## Install npm/pip dependencies, compile code
11+
make install-pypi
12+
13+
install-pypi:
14+
make setup-venv && make install-libs
15+
# re-install amazon_kclpy as it needs to re-download JAR files which are otherwise missing in the cached copy
16+
($(VENV_RUN); pip uninstall -y amazon_kclpy)
17+
($(VENV_RUN); cat requirements.txt | grep 'amazon_kclpy==' | xargs pip install --no-cache)
18+
make compile
19+
20+
setup-venv:
1121
(test `which virtualenv` || pip install virtualenv || sudo pip install virtualenv)
1222
(test -e $(VENV_DIR) || virtualenv $(VENV_DIR))
1323
($(VENV_RUN) && pip install --upgrade pip)
1424
(test ! -e requirements.txt || ($(VENV_RUN) && pip install -r requirements.txt))
25+
26+
install-libs: ## Install npm/pip dependencies, compile code
1527
(test -e localstack/infra/elasticsearch || { mkdir -p localstack/infra; cd localstack/infra; test -f $(TMP_ARCHIVE_ES) || (curl -o $(TMP_ARCHIVE_ES) $(ES_URL)); cp $(TMP_ARCHIVE_ES) es.zip; unzip -q es.zip; mv elasticsearch* elasticsearch; rm es.zip; })
1628
(test -e localstack/infra/amazon-kinesis-client/aws-java-sdk-sts.jar || { mkdir -p localstack/infra/amazon-kinesis-client; curl -o localstack/infra/amazon-kinesis-client/aws-java-sdk-sts.jar $(AWS_STS_URL); })
1729
(npm install -g npm || sudo npm install -g npm)
1830
(cd localstack/ && (test ! -e package.json || (npm install)))
19-
make compile
20-
# make install-web
2131

2232
install-web: ## Install npm dependencies for dashboard Web UI
2333
(cd localstack/dashboard/web && (test ! -e package.json || npm install))
2434

2535
compile: ## Compile Java code (KCL library utils)
36+
echo "Compiling"
37+
$(VENV_RUN); python -c 'from localstack.utils.kinesis import kclipy_helper; print kclipy_helper.get_kcl_classpath()'
2638
javac -cp $(shell $(VENV_RUN); python -c 'from localstack.utils.kinesis import kclipy_helper; print kclipy_helper.get_kcl_classpath()') localstack/utils/kinesis/java/com/atlassian/*.java
2739
# TODO enable once we want to support Java-based Lambdas
2840
# (cd localstack/mock && mvn package)
@@ -57,4 +69,4 @@ clean: ## Clean up (npm dependencies, downloaded infrastructure code
5769
rm -f localstack/utils/kinesis/java/com/atlassian/*.class
5870
rm -f $(TMP_ARCHIVE_ES)
5971

60-
.PHONY: usage compile clean install web install-web infra test
72+
.PHONY: usage compile clean install web install-web infra test install-libs

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ make web
112112

113113
## Change Log
114114

115+
* v0.1.8: Fix installation of JARs in amazon_kclpy if localstack is installed transitively
115116
* v0.1.7: Bump version of amazon_kclpy to 1.4.0
116117
* v0.1.6: Add travis-ci and coveralls configuration
117118
* v0.1.5: Refactor Elasticsearch utils; fix bug in method to delete all ES indexes

‎localstack/utils/kinesis/kclipy_helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
from __future__ import print_function
44
from amazon_kclpy import kcl
55
from glob import glob
6-
from localstack.utils.common import save_file
6+
from localstack.utils.common import save_file, run
77
import os
88
import argparse
99
import sys
1010
import samples
11+
import traceback
1112

1213

1314
def get_dir_of_file(f):
@@ -19,7 +20,8 @@ def get_kcl_dir():
1920

2021

2122
def get_kcl_jar_path():
22-
return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))
23+
jars = ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))
24+
return jars
2325

2426

2527
def get_kcl_classpath(properties=None, paths=[]):

‎setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ def do_make_install(workdir=None):
3434
if workdir:
3535
prev_workdir = os.getcwd()
3636
os.chdir(workdir)
37-
out = subprocess.check_output('make install', shell=True)
37+
try:
38+
out = subprocess.check_output('make install-pypi', shell=True)
39+
except subprocess.CalledProcessError as e:
40+
print e.output
41+
raise e
3842
if workdir:
3943
os.chdir(prev_workdir)
4044

@@ -72,7 +76,7 @@ def run(self):
7276

7377
setup(
7478
name='localstack',
75-
version='0.1.7',
79+
version='0.1.8',
7680
description='Provides an easy-to-use test/mocking framework for developing Cloud applications',
7781
author='Waldemar Hummer (Atlassian)',
7882
author_email='[email protected]',

0 commit comments

Comments
 (0)