2

My package has a hidden directory I want to distribute as package data. I include the following in distutils.setup(...):

[...]
package_data={'mypkg': ['.hg/*']},
[...]

However this syntax does not work: when I run python setup.py install, the directory .hg is not included in the package. I believe the problem is in the directory name .hg, because if I replace .hg with hg, then the following will work as expected.

[...]
package_data={'mypkg': ['hg/*']},
[...]

Unfortunately the directory name has to be .hg for Mercurial to work. Is there a workaround to this issue?

astabada
  • 1,029
  • 4
  • 13
  • 26
  • 1
    I cannot reproduce it. `package_data={'mypkg': ['../.git/*']}` included `.git/*` in `sdist`, `bdist_egg` and `bdist_wheel`. May be you need to upgrade `setuptools`? – phd Feb 14 '18 at 13:34
  • @phd Thanks for your comment, I have the latest version of `setuptools`. What version are you using? – astabada Feb 15 '18 at 00:24
  • `setuptools 38.4.0` – phd Feb 15 '18 at 00:25
  • 1
    @phd Sorry for the newbieness, but I used from `distutils.core import setup` instead of `from setuptools import setup`. This made the difference. If you could please take the time to formulate this as an answer I will make sure to accept it. – astabada Feb 15 '18 at 00:29

1 Answers1

1

Seems to work with setuptools (instead of distutils):

package_data={'mypkg': ['../.git/*']}

includes .git/* (non-recursive) in sdist, bdist_egg and bdist_wheel.

phd
  • 82,685
  • 13
  • 120
  • 165