Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make maven repository configurable via an env var #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -49,6 +52,7 @@
'argparse',
]
REMOTE_MAVEN_PACKAGES_FILE = 'pom.xml'
MAVEN_REPOSITORY = os.getenv('MAVEN_REPOSITORY', 'https://search.maven.org')

class MavenJarDownloader:

Expand Down Expand Up @@ -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('.')),
Expand Down