Re: [Distutils] problem with sdist for nested packages

2010-09-09 Thread Doug Hellmann

On Sep 8, 2010, at 12:56 PM, P.J. Eby wrote:

 At 12:00 PM 9/8/2010 -0400, Doug Hellmann wrote:
 Instead of explicitly listing packages, I use find_package_data() and then 
 get the package names from that result.  The odd thing is I get a package 
 PyMOTW.ElementTree but not PyMOTW.xml.etree.ElementTree.  Maybe I'm 
 misunderstanding/misusing find_package_data(), since that nested package is 
 the only one I'm having problems with.
 
 You want find_packages():
 
 http://peak.telecommunity.com/DevCenter/setuptools#using-find-packages

That took care of it. Thanks for the help!

Doug

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


[Distutils] problem with sdist for nested packages

2010-09-08 Thread Doug Hellmann
I'm having some problems creating an sdist for a nested package where some of 
the levels only include __init__.py and the subdirectories.  The full list of 
files is fairly long, but here's a snippet to give you an idea of the layout 
for the inputs:

PyMOTW/xml
PyMOTW/xml/__init__.py
PyMOTW/xml/etree
PyMOTW/xml/etree/__init__.py
PyMOTW/xml/etree/ElementTree
PyMOTW/xml/etree/ElementTree/__init__.py
PyMOTW/xml/etree/ElementTree/ElementTree_create.py
PyMOTW/xml/etree/ElementTree/...

When I build the sdist, I get:

build/lib/PyMOTW/xml
build/lib/PyMOTW/xml/etree
build/lib/PyMOTW/xml/etree/ElementTree
build/lib/PyMOTW/xml/etree/ElementTree/__init__.py
build/lib/PyMOTW/xml/etree/ElementTree/ElementTree_create.py
build/lib/PyMOTW/xml/etree/ElementTree/...

The __init__.py at the xml and xml/etree levels are not included.  As a 
result, the sdist won't install because it wants to populate a 
PyMOTW.ElementTree package but the directory doesn't exist.  I also tried 
adding other .py files at those levels in the directory structure (in case an 
empty directory was being ignored), but that had no effect.

The traceback I get trying to install the sdist is:

Traceback (most recent call last):
  File setup.py, line 7, in module
paver.tasks.main()
  File paver-minilib.zip/paver/tasks.py, line 621, in main
  File paver-minilib.zip/paver/tasks.py, line 604, in _launch_pavement
  File paver-minilib.zip/paver/tasks.py, line 569, in _process_commands
  File paver-minilib.zip/paver/setuputils.py, line 146, in __call__
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py,
 line 972, in run_command
cmd_obj.run()
  File 
/Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/install.py,
 line 71, in run
_install.run(self)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py,
 line 563, in run
self.run_command('build')
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py,
 line 326, in run_command
self.distribution.run_command(command)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py,
 line 972, in run_command
cmd_obj.run()
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py,
 line 127, in run
self.run_command(cmd_name)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py,
 line 326, in run_command
self.distribution.run_command(command)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py,
 line 972, in run_command
cmd_obj.run()
  File 
/Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/build_py.py,
 line 77, in run
self.build_packages()
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py,
 line 366, in build_packages
modules = self.find_package_modules(package, package_dir)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py,
 line 218, in find_package_modules
self.check_package(package, package_dir)
  File 
/Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/build_py.py,
 line 192, in check_package
init_py = _build_py.check_package(self, package, package_dir)
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py,
 line 191, in check_package
package directory '%s' does not exist % package_dir)
distutils.errors.DistutilsFileError: package directory 'PyMOTW/ElementTree' 
does not exist

Has anyone seen this problem before?

Thanks,
Doug

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] problem with sdist for nested packages

2010-09-08 Thread Doug Hellmann
Forgot to include version info:

Python 2.7
distribute 0.6.10
Paver 1.0.3

Doug

On Sep 8, 2010, at 7:34 AM, Doug Hellmann wrote:

 I'm having some problems creating an sdist for a nested package where some of 
 the levels only include __init__.py and the subdirectories.  The full list of 
 files is fairly long, but here's a snippet to give you an idea of the layout 
 for the inputs:
 
 PyMOTW/xml
 PyMOTW/xml/__init__.py
 PyMOTW/xml/etree
 PyMOTW/xml/etree/__init__.py
 PyMOTW/xml/etree/ElementTree
 PyMOTW/xml/etree/ElementTree/__init__.py
 PyMOTW/xml/etree/ElementTree/ElementTree_create.py
 PyMOTW/xml/etree/ElementTree/...
 
 When I build the sdist, I get:
 
 build/lib/PyMOTW/xml
 build/lib/PyMOTW/xml/etree
 build/lib/PyMOTW/xml/etree/ElementTree
 build/lib/PyMOTW/xml/etree/ElementTree/__init__.py
 build/lib/PyMOTW/xml/etree/ElementTree/ElementTree_create.py
 build/lib/PyMOTW/xml/etree/ElementTree/...
 
 The __init__.py at the xml and xml/etree levels are not included.  As a 
 result, the sdist won't install because it wants to populate a 
 PyMOTW.ElementTree package but the directory doesn't exist.  I also tried 
 adding other .py files at those levels in the directory structure (in case an 
 empty directory was being ignored), but that had no effect.
 
 The traceback I get trying to install the sdist is:
 
 Traceback (most recent call last):
  File setup.py, line 7, in module
paver.tasks.main()
  File paver-minilib.zip/paver/tasks.py, line 621, in main
  File paver-minilib.zip/paver/tasks.py, line 604, in _launch_pavement
  File paver-minilib.zip/paver/tasks.py, line 569, in _process_commands
  File paver-minilib.zip/paver/setuputils.py, line 146, in __call__
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py,
  line 972, in run_command
cmd_obj.run()
  File 
 /Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/install.py,
  line 71, in run
_install.run(self)
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py,
  line 563, in run
self.run_command('build')
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py,
  line 326, in run_command
self.distribution.run_command(command)
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py,
  line 972, in run_command
cmd_obj.run()
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py,
  line 127, in run
self.run_command(cmd_name)
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py,
  line 326, in run_command
self.distribution.run_command(command)
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py,
  line 972, in run_command
cmd_obj.run()
  File 
 /Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/build_py.py,
  line 77, in run
self.build_packages()
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py,
  line 366, in build_packages
modules = self.find_package_modules(package, package_dir)
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py,
  line 218, in find_package_modules
self.check_package(package, package_dir)
  File 
 /Users/dhellmann/.virtualenvs/pymotwtest/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/setuptools/command/build_py.py,
  line 192, in check_package
init_py = _build_py.check_package(self, package, package_dir)
  File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py,
  line 191, in check_package
package directory '%s' does not exist % package_dir)
 distutils.errors.DistutilsFileError: package directory 'PyMOTW/ElementTree' 
 does not exist
 
 Has anyone seen this problem before?
 
 Thanks,
 Doug
 

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] problem with sdist for nested packages

2010-09-08 Thread Eric Smith

On 9/8/10 7:34 AM, Doug Hellmann wrote:

I'm having some problems creating an sdist for a nested package where some of 
the levels only include __init__.py and the subdirectories.  The full list of 
files is fairly long, but here's a snippet to give you an idea of the layout 
for the inputs:


snip


Has anyone seen this problem before?


What does your setup.py look like?

--
Eric.
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] problem with sdist for nested packages

2010-09-08 Thread Doug Hellmann

On Sep 8, 2010, at 7:37 AM, Eric Smith wrote:

 On 9/8/10 7:34 AM, Doug Hellmann wrote:
 I'm having some problems creating an sdist for a nested package where some 
 of the levels only include __init__.py and the subdirectories.  The full 
 list of files is fairly long, but here's a snippet to give you an idea of 
 the layout for the inputs:
 
 snip
 
 Has anyone seen this problem before?
 
 What does your setup.py look like?

I'm using Paver, which wraps setuptools.  My pavement.py file is pasted below.  

Instead of explicitly listing packages, I use find_package_data() and then get 
the package names from that result.  The odd thing is I get a package 
PyMOTW.ElementTree but not PyMOTW.xml.etree.ElementTree.  Maybe I'm 
misunderstanding/misusing find_package_data(), since that nested package is the 
only one I'm having problems with.  It seems to work fine for all of the other 
subdirectories of PyMOTW, but this is the only one where the real code is more 
than one level deep.

Doug



#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#



# Standard library
import os
import sys
import tabnanny
import traceback
import types

# Set up Paver
import paver
import paver.doctools
import paver.misctasks
from paver.path import path
from paver.easy import *
import paver.setuputils
paver.setuputils.install_distutils_tasks()
try:
from sphinxcontrib import paverutils
except:
paverutils = None

# TODO
# - move these variables to options?

# What project are we building?
PROJECT = 'PyMOTW'

# What version is this?
VERSION = '1.124'

# The sphinx templates expect the VERSION in the shell environment
os.environ['VERSION'] = VERSION

# What is the current module being documented?
MODULE = path('module').text().rstrip()
os.environ['MODULE'] = MODULE

# Read the long description to give to setup
README = path('README.txt').text()

# Scan the input for package information
# to grab any data files (text, images, etc.) 
# associated with sub-packages.
PACKAGE_DATA = paver.setuputils.find_package_data(PROJECT, 
  package=PROJECT,
  only_in_packages=True,
  )

options(
setup=Bunch(
name = PROJECT,
version = VERSION,

description = 'Python Module of the Week Examples: ' + MODULE,
long_description = README,

author = 'Doug Hellmann',
author_email = 'doug.hellm...@gmail.com',

url = 'http://www.doughellmann.com/PyMOTW/',
download_url = 'http://www.doughellmann.com/downloads/%s-%s.tar.gz' % \
(PROJECT, VERSION),

classifiers = [ 'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Software Development',
],

platforms = ('Any',),
keywords = ('python', 'PyMOTW', 'documentation'),

# It seems wrong to have to list recursive packages explicitly.
packages = sorted(PACKAGE_DATA.keys()),
package_data=PACKAGE_DATA,
zip_safe=False,

scripts=['motw'],

),

sdist = Bunch(
),

sdistext = Bunch(
outdir='~/Desktop',
),

sphinx = Bunch(
sourcedir=PROJECT,
docroot = '.',
builder = 'html',
doctrees='sphinx/doctrees',
confdir = 'sphinx',
template_args = { 'module':MODULE }
),

html = Bunch(
builddir='%s/docs' % PROJECT,
outdir='%s/docs' % PROJECT,
templates='pkg',
),

text = Bunch(
builddir='%s/docs' % PROJECT,
outdir='%s/docs' % PROJECT,
templates='pkg',
builder='text',
),

website=Bunch(
templates = 'web',
builddir = 'web',

# What server hosts the website?
server = 'www.doughellmann.com',
server_path = '/var/www/doughellmann/DocumentRoot/PyMOTW/',

# What template should be used for the web site HTML?
template_source = 
'~/Devel/doughellmann/doughellmann/templates/base.html',
template_dest = 'sphinx/templates/web/base.html',
),

sitemap_gen=Bunch(
# Where is the config file for sitemap_gen.py?
config='sitemap_gen_config.xml',
),

pdf=Bunch(
templates='pkg',
builddir='web',
builder='latex',
),

blog=Bunch(
sourcedir=path(PROJECT)/MODULE,
builddir='blog_posts',
outdir='blog_posts',
confdir='sphinx/blog',

Re: [Distutils] problem with sdist for nested packages

2010-09-08 Thread P.J. Eby

At 12:00 PM 9/8/2010 -0400, Doug Hellmann wrote:
Instead of explicitly listing packages, I use find_package_data() 
and then get the package names from that result.  The odd thing is I 
get a package PyMOTW.ElementTree but not 
PyMOTW.xml.etree.ElementTree.  Maybe I'm misunderstanding/misusing 
find_package_data(), since that nested package is the only one I'm 
having problems with.


You want find_packages():

http://peak.telecommunity.com/DevCenter/setuptools#using-find-packages


___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] problem with sdist for nested packages

2010-09-08 Thread Doug Hellmann

On Sep 8, 2010, at 12:56 PM, P.J. Eby wrote:

 At 12:00 PM 9/8/2010 -0400, Doug Hellmann wrote:
 Instead of explicitly listing packages, I use find_package_data() and then 
 get the package names from that result.  The odd thing is I get a package 
 PyMOTW.ElementTree but not PyMOTW.xml.etree.ElementTree.  Maybe I'm 
 misunderstanding/misusing find_package_data(), since that nested package is 
 the only one I'm having problems with.
 
 You want find_packages():
 
 http://peak.telecommunity.com/DevCenter/setuptools#using-find-packages

Thanks, I'll give that a try.

Doug

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig