-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
histoqc.ui: need to provide package_data via setup.py
It would be possible to switch to setup.cfg declarative config style, if we'd specify the files individually, or add subfolder matching via multiple single star globs, i.e.: *.css, */*.css, */*/*.css, but unless all files are specified or pypa/setuptools#1806 is implemented it would probably cause confusion for a histoqc developer when they're modifying the ui.
- Loading branch information
Showing
2 changed files
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
# This setup.py file is just needed to support editable installs via | ||
# `pip install -e .` and `python setup.py develop` | ||
# | ||
# NOTE: | ||
# If you want an editable install `python setup.py develop` should | ||
# not be used and you should always use `pip install -e .` | ||
# But, it's almost guaranteed that some user will install via | ||
# the former, and so let's make setuptools_scm work correctly | ||
# in that case. | ||
# | ||
import glob | ||
import os.path | ||
from setuptools import setup | ||
|
||
# glob patterns in setup.cfg dont support recursive patterns | ||
# https://github.com/pypa/setuptools/issues/1806 | ||
# so we have to do it in setup.py | ||
ui_files = [ | ||
os.path.relpath(f, "histoqc/ui/") | ||
for f in glob.iglob("histoqc/ui/UserInterface/**/*", recursive=True) | ||
if os.path.isfile(f) | ||
] | ||
|
||
setup( | ||
# providing the settings is required for `python setup.py develop` | ||
# to work correctly with setuptools_scm | ||
# > set to `True` if we only allow `pip install -e .` | ||
# ^^^ `True` requires a pyproject.toml with the below config! | ||
use_scm_version={ | ||
# duplicated config from pyproject.toml; keep in sync | ||
"write_to": "histoqc/_version.py", | ||
"version_scheme": "post-release", | ||
}, | ||
setup_requires=['setuptools_scm'] | ||
setup_requires=['setuptools_scm'], | ||
package_data={ | ||
'histoqc.ui': ui_files | ||
} | ||
) |