fix: use entry_points for windows

python converts entry_points to exe files so they run on windows.  The scripts that work on linux/macos don't work on windows.
This commit is contained in:
Bryce 2023-02-05 19:09:27 -08:00 committed by Bryce Drennan
parent 5bedaebe45
commit d1dbd500eb
3 changed files with 23 additions and 1 deletions

View File

@ -47,6 +47,7 @@ deploy: ## Deploy the package to pypi.org
git push --tags
rm -rf dist
python setup.py bdist_wheel
python setup.py bdist_wheel --plat-name=win-amd64
#python setup.py sdist
@echo 'pypi.org Username: '
@read username && twine upload --verbose dist/* -u $$username;

View File

@ -298,6 +298,9 @@ docker run -it --gpus all -v $HOME/.cache/huggingface:/root/.cache/huggingface -
## ChangeLog
**9.0.1**
- fix: use entry_points for windows since setup.py scripts doesn't work on windows [#239](https://github.com/brycedrennan/imaginAIry/issues/239)
**9.0.0**
- perf: cli now has minimal overhead such that `aimg --help` runs in ~650ms instead of ~3400ms

View File

@ -1,5 +1,22 @@
import sys
from setuptools import find_packages, setup
is_for_windows = len(sys.argv) >= 3 and sys.argv[2].startswith("--plat-name=win")
if is_for_windows:
scripts = None
entry_points = {
"console_scripts": [
"imagine=imaginairy.cmds:imagine_cmd",
"aimg=imaginairy.cmds:aimg",
],
}
else:
scripts = ["imaginairy/bin/aimg", "imaginairy/bin/imagine"]
entry_points = None
with open("README.md", encoding="utf-8") as f:
readme = f.read()
@ -16,7 +33,8 @@ setup(
"Source": "https://github.com/brycedrennan/imaginAIry",
},
packages=find_packages(include=("imaginairy", "imaginairy.*")),
scripts=["imaginairy/bin/aimg", "imaginairy/bin/imagine"],
scripts=scripts,
entry_points=entry_points,
package_data={
"imaginairy": [
"configs/*.yaml",