[Python-bugs-list] [ python-Bugs-608033 ] Implied __init__.py not copied

noreply@sourceforge.net noreply@sourceforge.net
Thu, 12 Sep 2002 10:19:22 -0700


Bugs item #608033, was opened at 2002-09-11 13:13
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=608033&group_id=5470

Category: Distutils
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Tom Epperly (tepperly)
Assigned to: Nobody/Anonymous (nobody)
Summary: Implied __init__.py not copied

Initial Comment:
The setup method in distutils won't allow me to specify
packages and py_modules, and it doesn't correctly
deduce all of the directories that need __init__.py
files copied.  See the attached setup.py for an
example. This setup.py is automatically generated from
a cca.sidl file containing an interface description.

In my example, the directory structure is as follows:
gov/
gov/cca/
gov/cca/ports/
decaf/
decaf/ports
The problem is that gov/ only contains __init__.py.

If I specific packages and py_modules in my setup call,
I see the following:
[epperly@tux06 runPython]$ python2.2 setup.py
--include-dirs=`cd ../../../runtime/python && pwd`
--include-dirs=`cd ../../../runtime/sidl && pwd`
--include-dirs=`cd . && pwd` --library-dirs=`cd
../../../runtime/sidl/.libs && pwd` install
--prefix=/tmp/pytest
running install
running build
running build_py
error: build_py: supplying both 'packages' and
'py_modules' options is not allowed
[epperly@tux06 runPython]$ 

If I comment out the "packages = []" part and do a
"python setup.py install", it doesn't copy 
gov/__init__.py, decaf/__init__.py and
decaf/ports/__init__.py to the installation directory.

>From this data, it appears that distutils isn't
deducing the package list correctly from py_modules and
ext_modules. For each element of py_modules, it should
add all the parent modules. For an py_modules entry,
a.b.c.d.e.f, distutils should add a, a.b, a.b.c,
a.b.c.d, and a.b.c.d.e to the package list.

distutils should also glean package names from the
ext_modules list.


----------------------------------------------------------------------

>Comment By: Tom Epperly (tepperly)
Date: 2002-09-12 10:19

Message:
Logged In: YES 
user_id=94539

I read the section loewis linked me to, and the example
given there has 'mod1' in the "root package" and "pkg.mod2"
in the pkg/ package. This leads me to believe that
py_modules do not go into a single package as loewis suggests.

In addition, distutils should copy __init__.py files implied
by the list of C extension modules.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-09-12 00:04

Message:
Logged In: YES 
user_id=21627

It appears that you are misunderstanding the meaning of the
py_modules argument. See

http://www.python.org/doc/current/dist/setup-script.html#SECTION000320000000000000000

It says "specially the case of a single module that goes in
the ``root package'' "

All py_modules modules are in a single package, irrespective
of their source location.

----------------------------------------------------------------------

Comment By: Tom Epperly (tepperly)
Date: 2002-09-11 13:22

Message:
Logged In: YES 
user_id=94539

I am surprised that sourceforge let me assign this to someone.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=608033&group_id=5470