From 9f7cd551c28f4c4c27699da8111df3f9acf0a6f8 Mon Sep 17 00:00:00 2001 From: msinto93 <32672516+msinto93@users.noreply.github.com> Date: Wed, 5 Apr 2023 19:41:25 +0100 Subject: [PATCH] Make maven repository configurable via an env var, default to public maven repo --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9df1062..6030651 100644 --- a/setup.py +++ b/setup.py @@ -15,10 +15,12 @@ if sys.version_info[0] >= 3: # Python 3 + from urllib.parse import urljoin from urllib.request import urlopen else: # Python 2 from urllib2 import urlopen + from urlparse import urljoin # # This script modifies the basic setuptools by adding some functionality to the standard @@ -38,6 +40,7 @@ # # Will retrieve the configured jars from maven and then advise the user # to rerun the install command. +# To download the jars from a custom maven repository, set the env var `MAVEN_REPOSITORY`. # PACKAGE_NAME = 'amazon_kclpy' @@ -49,6 +52,7 @@ 'argparse', ] REMOTE_MAVEN_PACKAGES_FILE = 'pom.xml' +MAVEN_REPOSITORY = os.getenv('MAVEN_REPOSITORY', 'https://search.maven.org') class MavenJarDownloader: @@ -115,7 +119,7 @@ def package_url(self, group_id, artifact_id, version): # Sample url: # https://search.maven.org/remotecontent?filepath=org/apache/httpcomponents/httpclient/4.2/httpclient-4.2.jar # - prefix = 'https://search.maven.org/remotecontent?filepath=' + prefix = urljoin(MAVEN_REPOSITORY, 'remotecontent?filepath=') return '{prefix}{path}/{artifact_id}/{version}/{dest}'.format( prefix=prefix, path='/'.join(group_id.split('.')),