Skip to content

Conversation

@broccoliboy
Copy link
Contributor

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.

akshayaurora
akshayaurora previously approved these changes Jun 10, 2025
@akshayaurora
Copy link
Member

@broccoliboy would you please look at and fix the issues with tests.

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'))
Copy link
Contributor

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.

Copy link
Contributor Author

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.

# 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:
Copy link
Contributor

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

for key in ['HTTP_PROXY', 'http_proxy', 'HTTPS_PROXY', 'https_proxy']:
proxy = os.environ.get(key)
try:
host, port = proxy.split(':')[-2:]
Copy link
Contributor

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:]

@kuzeyron
Copy link
Contributor

kuzeyron commented Nov 4, 2025

LGTM!

@kuzeyron kuzeyron merged commit 1e3d533 into kivy:master Nov 4, 2025
26 checks passed
@broccoliboy broccoliboy deleted the feature/sdkmanager-proxy branch November 5, 2025 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants