I want to install data_files (in this case just one html file) into a project's root directory. I can do it if I set the path absolute like 'user/documents/app', but I need the data files to be installable wherever the person installing the app happens to have their project. If that makes sense. So, I've been troubleshooting how to find and execute the directory of the project path, but with no luck. See below. I'm trying to "pass in" the path_to variable in my data_file array, but its not working. Ideally I would like the data_files go to the user's templates directory.
import os
from setuptools import setup
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
_ROOT = os.path.abspath(os.path.dirname(__file__))
path_to = os.path.join(_ROOT, "styleguides")
setup(
name='styleguide',
version='1.0',
packages=['styleguide'],
package_data={'styleguide': [
'styleguides/styleguide.html',
]},
include_package_data=True,
data_files = [(path_to, ['styleguide/styleguides/styleguide.html']),],
license='BSD License',
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
This apps directory structure is:
Project/
styleguide/
__init__.py
styleguides/
styleguide.html