Skip to content

Commit

Permalink
Merge pull request #15 from dsm-72/package-data
Browse files Browse the repository at this point in the history
add package data to setup
  • Loading branch information
jph00 authored Aug 27, 2024
2 parents 64b158c + 7387b97 commit 9f8b4aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
config.read('settings.ini', encoding='utf-8')
cfg = config['DEFAULT']

# NOTE: package_data is missing from here
cfg_keys = 'version description keywords author author_email'.split()
expected = cfg_keys + "lib_name user branch license status min_python audience language".split()
for o in expected: assert o in cfg, "missing expected setting: {}".format(o)
Expand All @@ -30,6 +31,14 @@
lic = licenses.get(cfg['license'].lower(), (cfg['license'], None))
dev_requirements = (cfg.get('dev_requirements') or '').split()

# NOTE: handle package_data here e.g. in settings.ini `package_data = ../data/defaults.yml`
package_data = dict()
pkg_data = cfg.get('package_data', None)
if pkg_data:
package_data[cfg['lib_name']] = pkg_data.split() # split as multiple files might be listed
# Add package data to setup_cfg for setuptools.setup(..., **setup_cfg)
setup_cfg['package_data'] = package_data

setuptools.setup(
name = cfg['lib_name'],
license = lic[0],
Expand All @@ -40,7 +49,7 @@
] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []),
url = cfg['git_url'],
packages = setuptools.find_packages(),
include_package_data = True,
include_package_data = True, # NOTE: unclear if this automatically determines package data and if so how
install_requires = requirements,
extras_require={ 'dev': dev_requirements },
dependency_links = cfg.get('dep_links','').split(),
Expand Down

0 comments on commit 9f8b4aa

Please sign in to comment.