Skip to content

Commit

Permalink
Improve platform detection for sling dependencies
Browse files Browse the repository at this point in the history
- Replaced conditional dependency specification with more readable and maintainable code.
- Added error handling for unsupported platforms.
- Improved code clarity and readability.
  • Loading branch information
flarco committed Feb 3, 2025
1 parent d2c6984 commit 76da57c
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions sling/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,24 @@
with readme_path.open() as file:
README = file.read()

install_requires = [
f'sling-linux-arm64=={SLING_VERSION} ; platform_system=="Linux" and platform_machine=="aarch64"',
f'sling-linux-amd64=={SLING_VERSION} ; platform_system=="Linux" and platform_machine=="aarch64"',
f'sling-windows-arm64=={SLING_VERSION} ; platform_system=="Windows" and platform_machine=="ARM64"',
f'sling-windows-amd64=={SLING_VERSION} ; platform_system=="Windows" and platform_machine!="ARM64"',
f'sling-mac-arm64=={SLING_VERSION} ; platform_system=="Darwin" and platform_machine=="arm64"',
f'sling-mac-amd64=={SLING_VERSION} ; platform_system=="Darwin" and platform_machine!="arm64"',
]
install_requires = []
if platform.system() == 'Linux':
if platform.machine() == 'aarch64':
install_requires = [f'sling-linux-arm64=={SLING_VERSION}']
else:
install_requires = [f'sling-linux-amd64=={SLING_VERSION}']
elif platform.system() == 'Windows':
if platform.machine() == 'ARM64':
install_requires = [f'sling-windows-arm64=={SLING_VERSION}']
else:
install_requires = [f'sling-windows-amd64=={SLING_VERSION}']
elif platform.system() == 'Darwin':
if platform.machine() == 'arm64':
install_requires = [f'sling-mac-arm64=={SLING_VERSION}']
else:
install_requires = [f'sling-mac-amd64=={SLING_VERSION}']
else:
raise Exception(f'platform "{platform.system()}" ({platform.system()}) not supported.')

setup(
name='sling',
Expand Down

0 comments on commit 76da57c

Please sign in to comment.