Skip to content

Commit

Permalink
setup changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Apr 17, 2021
1 parent 48db84c commit 6136974
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,38 @@

if os.name == 'nt':
for required_package, pipwin_dependencies in BUILT_PACKAGES.items():
try:
importlib.import_module(required_package)
except:
failed_pipwin_packages = []
iterations = len(pipwin_dependencies)

for _ in range(iterations):
try:
import pipwin
importlib.import_module(required_package)
except:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'pipwin'])
subprocess.check_call([sys.executable, '-m', 'pipwin', 'refresh'])

failed_pipwin_packages = []
for pipwin_package in pipwin_dependencies + [required_package]:
try:
subprocess.check_call(
[sys.executable, '-m', 'pipwin', 'install', pipwin_package.lower()]
)
except subprocess.CalledProcessError:
failed_pipwin_packages.append(pipwin_package)
import pipwin
except:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'pipwin'])
subprocess.check_call([sys.executable, '-m', 'pipwin', 'refresh'])

for pipwin_package in pipwin_dependencies + [required_package]:
try:
subprocess.check_call(
[sys.executable, '-m', 'pipwin', 'install', pipwin_package.lower()]
)
if pipwin_package in failed_pipwin_packages:
failed_pipwin_packages.remove(pipwin_package)
except subprocess.CalledProcessError:
failed_pipwin_packages.append(pipwin_package)

if len(failed_pipwin_packages) == 0:
break

if len(failed_pipwin_packages) > 0:
raise RuntimeError(
f'failed to download or install non-conda Windows build(s) of {" and ".join(failed_pipwin_packages)}; you can either\n'
'1) install within an Anaconda environment, or\n'
f'2) `pip install <file>.whl`, with `<file>.whl` downloaded from {" and ".join("https://www.lfd.uci.edu/~gohlke/pythonlibs/#" + value.lower() for value in failed_pipwin_packages)} for your Python version'
)
if len(failed_pipwin_packages) > 0:
raise RuntimeError(
f'failed to download or install non-conda Windows build(s) of {" and ".join(failed_pipwin_packages)}; you can either\n'
'1) install within an Anaconda environment, or\n'
f'2) `pip install <file>.whl`, with `<file>.whl` downloaded from {" and ".join("https://www.lfd.uci.edu/~gohlke/pythonlibs/#" + value.lower() for value in failed_pipwin_packages)} for your Python version'
)

try:
try:
Expand Down Expand Up @@ -76,7 +84,7 @@
url=metadata['url'],
packages=find_packages(),
python_requires='>=3.8',
setup_requires=['dunamai', 'setuptools>=41.2'],
setup_requires=['dunamai', 'setuptools>=41.2', 'wheel'],
install_requires=[
'aprslib',
'haversine',
Expand Down

0 comments on commit 6136974

Please sign in to comment.