I have the following python project structure:
.
├ setup.py
├ doc
| ├ file.css
| ├ file.html
| └ file.js
└ src
├ matlabsources
| └ <several folders architecture with .m and .slx files>
└ mypythonpackage
├ __init__.py
└ <several sub packages architecture with python files>
I want to add all the files in the doc folder to my whl distribution file.
setuptools.setup(
name='myproject',
author='me',
packages=setuptools.find_packages(where='src', include=['packages*']),
package_dir={'': 'src'},
data_files ={'documentation': find_data_files('doc'), 'matlab': find_data_files('src/matlabsources')},
include_package_data=True,
install_requires=make_deps(REQS_FILENAME),
python_requires='>= 2.7', # Only compatible with Python 2.7.* and 3+
use_scm_version={'version_scheme': simple_version}, # setuptools_scm: the blessed package to manage your versions by scm tags
setup_requires=make_deps(SETUP_FILENAME),
cmdclass=dict(bdist_egg=custom_bdist_egg, build=custom_build, activateIniGeneration=activateIniGeneration)
)
def find_data_files(directory):
"""
Using glob patterns in ``package_data`` that matches a directory can
result in setuptools trying to install that directory as a file and
the installation to fail.
This function walks over the contents of *directory* and returns a list
of only filenames found.
"""
strip = os.path.dirname(os.path.abspath(__file__))
result = []
for root, dirs, files in os.walk(directory):
for filename in files:
filename = os.path.join(root, filename)
result.append(os.path.relpath(filename, strip))
print("\n".join(result))
return result
I get the following error:
error: can't copy 'documentation': doesn't exist or not a regular file
In my understanding, 'documentation' is the target directory, relative to sys.prefix
, it is normal it does not exist.
I am building with the following command:
python setup.py bdist_wheel --universal
I also have this warning
warning: install_data: setup script did not provide a directory for 'documentation' -- installing right in 'build\bdist.win32\wheel\myproject-1.7.z_gfdc81e60.d20201112.data\data'
Which make me think I need further configuration to my setup.py
for this to work
Where am I wrong ?