[Distutils] How to install examples files?

Michael Schwager mschwage at gmail.com
Sat Apr 7 01:48:21 EDT 2018


Hello,
I am trying to install a module with a package and also an examples
directory. How do I get my examples installed on users' machines into a
reasonable location, in a cross-platform kind of way?

 I notice that a number of Python examples are installed in /usr/share (in
Linux) or in  <home>\AppData\Local\Programs\Python\Python36\Share on
Windows 8.

So in my setup.py, I have this:

from setuptools import setup, find_packages
from codecs import open
from os import path

with open(path.join('.', 'README.md'), encoding='utf-8') as f:
   long_description = f.read()

setup(
   name='kivydnd',
   version='0.5.0',
   description='Kivy Drag-n-Drop for Widgets',
   long_description=long_description,
   long_description_content_type='text/markdown',
   url='https://github.com/GreyGnome/KivyDnD',
   author='GreyGnome',
   author_email='myemail at example.com',
   license='Apache License 2.0',
   keywords='kivy drag-n-drop',
   packages=find_packages(exclude=[]),
   data_files=[('share/kivydnd-examples', ['examples/dndexample1.py',])],
)

But when I try to install them on Linux, I don't see the dndexample1.py
file anywhere:

python setup.py sdist
pip install --target=/home/schwager/lib/python dist/kivydnd-0.5.0.tar.gz
--log /tmp/piplog

(Note that I am using a different target for testing).

The piplog shows that it at least tried to do something with the examples,
but I can find a directory by that name anywhere in my home directory:

<snippet from log>
   creating /tmp/tmpirrDx8/share/kivydnd-examples
   copying examples/dndexample1.py -> /tmp/tmpirrDx8/share/kivydnd-examples

Thanks!
-- 
-Mike Schwager
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20180407/d9223e69/attachment.html>


More information about the Distutils-SIG mailing list