Reputation: 169
My setup.py looks like this
setup = (
name='foo',
packages=['bin'],
package_data={'':['data/*.dat','data/usr/*/*.dat']},
)
And my directory looks like,
main_directory\
main.py
bin\
modules.py
functions.py
data\
main_data.dat
otherdata\
otherdata.dat
main.py
is the controller of the the functions and modules, are there any problems with my package structures? How can I build a right setup.py
and after install I can open it from terminal?
Upvotes: 3
Views: 1526
Reputation: 6429
I think you've misunderstood the setup.py
creation. In the distutils
(and setuptools
) package there's a function called setup()
. I think you want tu use it, but you're creating a tuple and assigning it to a variable called setup
. Also, name
should be a string.
It should be like this:
from distutils.core import setup
setup(
name='foo',
packages=['bin'],
package_data={'':['data/*.dat','data/usr/*/*.dat']},
)
You can install the above (saved as setup.py
) using:
python setup.py install
After this is done, you can use your package in the Python shell or other Python files like this:
import foo
from foo.bin.modules import whatever
whatever()
# assuming you have a function called whatever in bin/modules.py
Hope this helps!
Upvotes: 3