Re: [Pygui] Installing PyGUI-2.5 on Mac OSX 10.5.8 fails

Greg Ewing <[email protected]>
Newsgroups gmane.comp.gnome.gtk+.python,gmane.comp.python.pyobjc.devel,gmane.comp.python.pygui,gmane.comp.python.windows
Message-ID <[email protected]>
Colin Brown wrote:
> Macintosh:PyGUI-2.5 colin$ python setup.py install
> Traceback (most recent call last):
>   File "setup.py", line 12, in <module>
>     from distutils_extensions import pygui_build_py
> ImportError: No module named distutils_extensions

Sorry about that! The missing file is attached, and I'll
upload a fixed distribution soon.

-- 
Greg

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
distutils_extensions.py (text/plain, 2.1 KB)
#------------------------------------------------------------------------
#
#   PyGUI - Distutils hackery
#
#------------------------------------------------------------------------

import os, sys
from glob import glob
from distutils.dist import Distribution

if sys.version_info >= (3, 0):
	try:
		from distutils.command.build_py import build_py_2to3 as build_py
	except ImportError:
		raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x")
else:
	from distutils.command.build_py import build_py

#------------------------------------------------------------------------

class pygui_build_py(build_py):
	"""
	An extension of the distutils build_py command that supports
	gathering .py files for a package from multiple source directories.
	
	It provides a new option 'package_subdirs' that is a mapping from
	a package name to a list of directory paths:
	
	package_subdirs = {'package_name': ['source_dir', ...], ...}
	
	The directory paths are interpreted relative to the primary source
	directory for the package. In addition to .py files from the primary
	source directory, any .py files from the specified directories will be
	copied into the package during installation.
	"""
	
	Distribution.package_subdirs = {}
	
	def initialize_options(self):
		build_py.initialize_options(self)
		self.package_subdirs = {}
	
	def finalize_options(self):
		build_py.finalize_options(self)
		self.package_subdirs = self.distribution.package_subdirs
	
	def find_package_modules(self, package, package_dir):
		#print "distutils_extensions: Searching subdirectories of package", repr(package) ###
		modules = build_py.find_package_modules(self, package, package_dir)
		subdirs = self.package_subdirs.get(package, ())
		for subdir in subdirs:
			#print "Looking in subdir", repr(subdir), "of", repr(package_dir) ###
			module_files = glob(os.path.join(package_dir, subdir, "*.py"))
			for f in module_files:
				module = os.path.splitext(os.path.basename(f))[0]
				#print "Found module", repr(module), "in", repr(f) ###
				modules.append((package, module, f))
		return modules
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.