3

I'm packaging an in-house python app. My dir structure is something like:

/config
    \-- config.yaml
/app
    \-- ... (python files here...)

I've created a MANIFEST.in containing:

include config/*.yaml

When I extract the tarball created after running ./setup.py sdist, there are 2 directories, config (containing my config.yaml file) and app containing my package. However, when I pip install my app, only the python code is installed in dist-packages.

How can I make pip/setuptools copy config/config.yaml to /etc/xdg/app/ when I run pip install app?

Alternatively how can I at least make the config.yaml file end up somewhere on the filesystem so I can copy it where I want it later (e.g. /usr/share or somewhere - I don't care where it ends up after being installed)?

AlG
  • 14,697
  • 4
  • 41
  • 54
jbrown
  • 7,518
  • 16
  • 69
  • 117

1 Answers1

2

The docs section Installing Additional Files Doc suggests:

You can set the relative real path into data_files.

setup(...,
          data_files=[...,
                      ('/etc/xdg/app/', ['config/config.yaml'])]
     )

Obs: "Note that you can specify the directory names where the data files will be installed, but you cannot rename the data files themselves."

buhtz
  • 10,774
  • 18
  • 76
  • 149
jcfaracco
  • 853
  • 2
  • 6
  • 21
  • 1
    No I hadn't seen that. I'd seen that. The setuptools docs (http://pythonhosted.org/setuptools/setuptools.html#non-package-data-files) suggest it's not possible. Thanks! – jbrown Jan 30 '14 at 16:27