-
Notifications
You must be signed in to change notification settings - Fork 602
Android sdkmanager proxy config #1899
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
Conversation
…k on corporate networks
|
@broccoliboy would you please look at and fix the issues with tests. |
buildozer/targets/android.py
Outdated
| kwargs['cwd'] = kwargs.get('cwd', android_sdk_dir) | ||
| command = [self.sdkmanager_path, f"--sdk_root={android_sdk_dir}", *args] | ||
|
|
||
| http_proxy = os.environ.get('HTTP_PROXY', os.environ.get('http_proxy')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTPS should be included with these checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing. I updated to look at http and https env vars. Please let me know if you have any other feedback.
buildozer/targets/android.py
Outdated
| # only pass host and port with `http` type. | ||
| for key in ['HTTP_PROXY', 'http_proxy', 'HTTPS_PROXY', 'https_proxy']: | ||
| proxy = os.environ.get(key) | ||
| if proxy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If statement could be removed and just have try/except there
buildozer/targets/android.py
Outdated
| for key in ['HTTP_PROXY', 'http_proxy', 'HTTPS_PROXY', 'https_proxy']: | ||
| proxy = os.environ.get(key) | ||
| try: | ||
| host, port = proxy.split(':')[-2:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proxy = os.environ.get(key) could be set directly with host, port = proxy.split(':')[-2:] so it becomes host, port = os.environ.get(key).split(':')[-2:]
|
LGTM! |
This PR configures android sdkmanager to use system proxy info from env var http_proxy, which is needed for buildozer android to work on corporate networks with a proxy in place. Related to #142 but this seems like a simpler implementation that leverages env vars that are typically already defined while working in a corporate proxy setting.