Skip to content

Commit

Permalink
Added exclude_package_data feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Wilhelm authored and Florian Wilhelm committed Mar 19, 2015
1 parent 1db05cf commit 4362304
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Version 2.1, 2015-??-??
- Use alabaster as default Sphinx theme
- Automatically install Sphinx if necessary
- Added `include_package_data` again with support of `setuptools-git`
- Added `exclude_package_data` parameter in `setup.cfg`

Version 2.0.4, 2015-03-17
=========================
Expand Down
2 changes: 2 additions & 0 deletions pyscaffold/data/setup_cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ url = ${url}
# Include all additional data INSIDE your package AND tracked by git?
# If true this will install `setuptools-git` if not provided
include_package_data = false
# If include_package_data is true, exclude unintentionally included data.
exclude_package_data =
# Comma separated list of data INSIDE your package to include.
# DO NOT prepend the package name when specifying files and folders.
package_data =
Expand Down
4 changes: 4 additions & 0 deletions pyscaffold/data/setup_py.template
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def read_setup_cfg():
metadata['include_package_data'] = str2bool(include_package_data_bool)
if metadata['include_package_data']:
Distribution().fetch_build_eggs(['setuptools-git'])
exclude_data = metadata.get('exclude_package_data', '')
exclude_data = [item.strip() for item in exclude_data.split(',') if item]
metadata['exclude_package_data'] = exclude_data
package_data = metadata.get('package_data', '')
package_data = [item.strip() for item in package_data.split(',') if item]
metadata['package_data'] = package_data
Expand Down Expand Up @@ -530,6 +533,7 @@ def setup_package():
cmdclass=cmdclass,
tests_require=['pytest-cov', 'pytest'],
include_package_data=metadata['include_package_data'],
exclude_package_data={package: metadata['exclude_package_data']},
package_data={package: metadata['package_data']},
data_files=[('.', metadata['data_files'])],
command_options=command_options,
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ url = http://pyscaffold.readthedocs.org/
# Include all additional data INSIDE your package AND tracked by git?
# If true this will install `setuptools-git` if not provided
include_package_data = false
# If include_package_data is true, exclude unintentionally included data.
exclude_package_data =
# Comma separated list of data INSIDE your package to include.
# DO NOT prepend the package name when specifying files and folders.
package_data = data/*
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def read_setup_cfg():
metadata['include_package_data'] = str2bool(include_package_data_bool)
if metadata['include_package_data']:
Distribution().fetch_build_eggs(['setuptools-git'])
exclude_data = metadata.get('exclude_package_data', '')
exclude_data = [item.strip() for item in exclude_data.split(',') if item]
metadata['exclude_package_data'] = exclude_data
package_data = metadata.get('package_data', '')
package_data = [item.strip() for item in package_data.split(',') if item]
metadata['package_data'] = package_data
Expand Down Expand Up @@ -529,6 +532,7 @@ def setup_package():
cmdclass=cmdclass,
tests_require=['pytest-cov', 'pytest'],
include_package_data=metadata['include_package_data'],
exclude_package_data={package: metadata['exclude_package_data']},
package_data={package: metadata['package_data']},
data_files=[('.', metadata['data_files'])],
command_options=command_options,
Expand Down

0 comments on commit 4362304

Please sign in to comment.