Skip to content

Commit

Permalink
Issue #39: download correct custom jars for travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Apr 16, 2020
1 parent 157ddfc commit fd79739
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ addons:
install:
- pip install -r requirements.txt --extra-index-url https://artifactory.vgt.vito.be/api/pypi/python-openeo/simple
- pip install . --extra-index-url https://artifactory.vgt.vito.be/api/pypi/python-openeo/simple
- SPARK_HOME=$(find_spark_home.py) geopyspark install-jar
- mkdir -p jars && curl -sSf https://artifactory.vgt.vito.be/libs-snapshot-public/org/openeo/geotrellis-extensions/1.3.0-SNAPSHOT/geotrellis-extensions-1.3.0-SNAPSHOT.jar -o jars/geotrellis-extensions-1.3.0-SNAPSHOT.jar
- python scripts/get-jars.py
# command to run tests
script:
- pytest
4 changes: 1 addition & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,5 @@ python setup.py install bdist_egg

cd ../openeo-geopyspark-driver
pip install $(cat requirements.txt | tr '\n' ' ' | sed -e 's/openeo-api==0.0.1/openeo-api/') --extra-index-url https://artifactory.vgt.vito.be/api/pypi/python-openeo/simple
SPARK_HOME=$(find_spark_home.py) geopyspark install-jar
#mkdir -p jars && mvn dependency:copy -Dartifact=org.openeo:geotrellis-extensions:1.1.0-SNAPSHOT -DoutputDirectory=jars
mkdir -p jars && mvn dependency:get -DremoteRepositories=https://artifactory.vgt.vito.be/libs-snapshot-public/ -Dartifact=org.openeo:geotrellis-extensions:1.1.0-SNAPSHOT -DoutputDirectory=jars
python scripts/get-jars.py
python setup.py install bdist_egg
57 changes: 57 additions & 0 deletions scripts/get-jars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""
Script to download (custom) geotrellis backend assemly and geotrellis extensions jars
To be used instead of `geopyspark install-jar`
"""
import logging
from pathlib import Path
import subprocess
import urllib.request

logger = logging.getLogger("get-jars")


def ensure_jar_dir(jar_dir: Path) -> Path:
logger.info("Checking jar dir {j}".format(j=jar_dir))
if not jar_dir.exists():
logger.info("Creating jar dir {j}".format(j=jar_dir))
jar_dir.mkdir(parents=True)
assert jar_dir.is_dir()
return jar_dir


def download_jar(jar_dir: Path, url: str) -> Path:
target = jar_dir / (url.split("/")[-1])
if not target.exists():
logger.info("Downloading {t} from {u!r}".format(t=target, u=url))
urllib.request.urlretrieve(url, target)
assert target.exists()
logger.info("Got: {t}".format(t=target))
else:
logger.info("Already exists: {t}".format(t=target))
return target


def main():
logging.basicConfig(level=logging.INFO)

root_dir = Path(__file__).parent.parent.absolute()
jar_dir = ensure_jar_dir(root_dir / "jars")

download_jar(
jar_dir,
"https://artifactory.vgt.vito.be/libs-snapshot-public/org/openeo/geotrellis-extensions/1.3.0-SNAPSHOT/geotrellis-extensions-1.3.0-SNAPSHOT.jar"
)
download_jar(
jar_dir,
"https://artifactory.vgt.vito.be/auxdata-public/openeo/geotrellis-backend-assembly-0.4.5-openeo.jar"
)

logger.info("Listing of {j}:".format(j=jar_dir))
subprocess.call(["ls", "-al", str(jar_dir)])


if __name__ == '__main__':
main()

0 comments on commit fd79739

Please sign in to comment.