Reputation: 3381
I am developing a program ("homie") in python 2.7 with eclipse / pydev that contains several interfaces to external API providers. Those inherit a genric Interface-Class located inside the __init__.py
inside homie.interfaces
All those interfaces now should be contained in sub-packages of homie.interfaces
, such like homie.interfaces.foo
and homie.interfaces.bar
.
Following the divide-and-conquer concept I created new projects for each interface implementation, containing the respective packages, such like foo
, respectively bar
.
The problem is now, that my setup.py
script does of course not find the package myprogram.interfaces.foo
during setup.
Example: The worknet
interface
#! /usr/bin/env python
from distutils.core import setup
setup(
name='Worknet-DBs Interface',
version='0.1-indev',
author='Richard Neumann',
author_email='[email protected]',
packages=['homie.interfaces.worknet'],
data_files=[],
license=open('LICENSE.txt').read(),
description='Interface implementation for the Worknet APIs',
long_description=open('README.txt').read(),
)
Will produce:
[neumannr@neumann-homeinfo worknet.tmp]$ python ./setup.py install
running install
running build
running build_py
error: package directory 'homie/interfaces/worknet' does not exist
[neumannr@neumann-homeinfo worknet.tmp]$
If I specify just worknet
instead of homie.interfaces.worknet
it will of course install into the userbase instad of homie.interfaces
.
How can I tell the script to install the worknet
package into homie.interfaces
, so its path is homie.interfaces.worknet
?
Upvotes: 2
Views: 890
Reputation: 44152
package_dir
package_dir
parameter can provide information about where to find packages.
worknet
directoryAssuming, worknet
directory is directly in your project root, you shall dd parameter package_dir
into your setup
call
package_dir = {'homie.interfaces': ''}
homie/interfaces
Another option is, you reorganize your code directories. E.g .you creat a path homie/interfaces/
and into it you move the existing worknet
subdirectory.
In such a case, you would add
package_dir = {'homie.interfaces': 'homie/interfaces'}
Upvotes: 3