Tighter module creation code, and a module name typo from cut and paste.

This commit is contained in:
R. Bernstein
2008-11-28 13:44:56 -05:00
parent bd6ef49177
commit f191edc157
2 changed files with 18 additions and 25 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/build
/dist
/*.pyc
/pycdio.egg-info

View File

@@ -14,43 +14,35 @@ import os
README = os.path.join(os.path.dirname(__file__), 'README.txt')
long_description = open(README).read() + '\n\n'
# Find link args for libcdio and libiso9660 using pkg-config and add
# collect them into a list for setup's ext_modules.
libraries=[]
link_args=[]
for i, lib_name in enumerate(('libcdio', 'libiso9660',)):
# Find link args for libcdio and libiso9660 using pkg-config, create
# the right Extension for this to fit into ext_modules later.
modules = []
for lib_name in ('libcdio', 'libiso9660'):
short_libname = lib_name[3:] # Strip off "lib" from name
p = Popen(['pkg-config', '--libs', lib_name], stdout=PIPE)
if p.returncode is None:
link_args.append([p.communicate()[0]])
libraries.append(None) # Above includes libcdio
link_args = [p.communicate()[0].strip()]
lib = None # Above includes libcdio
else:
print ("Didn't the normal return code running pkg-config," +
"got:\n\t%s" % p.returncode)
short_libname = lib_name[3:] # Strip off "lib" from name
"on %s. got:\n\t%s" % [lib_name, p.returncode])
print "Will try to add %s anyway." % short_libname
link_args.append(None)
libraries.append(short_libname) # Strip off "lib" frame name
else:
libcdio_link_args = None
libcdio_library = ['cdio']
link_args = None
lib = short_libname # Strip off "lib" frame name
py_shortname='py' + short_libname
modules.append(Extension('_' + py_shortname,
libraries = lib,
extra_link_args = link_args,
sources=['swig/%s.i' % py_shortname]))
# FIXME: incorporate into above loop. E.g. using modules=[] var.
pycdio_module = Extension('_pycdio',
libraries=libraries[0],
extra_link_args=link_args[0],
sources=['swig/pycdio.i'])
pyiso9660_module = Extension('_pyiso9660',
libraries=libraries[1],
extra_link_args=link_args[1],
sources=['swig/pyiso9660.i'])
setup (name = 'pycdio',
author = 'Rocky Bernstein',
author_email = 'rocky@gnu.org',
description = 'Python OO interface to libcdio (CD Input and Control library)',
ext_modules = [pycdio_module, pyiso9660_module],
ext_modules = modules,
license = 'GPL',
long_description = long_description,
name = 'pytracer',
name = 'pycdio',
py_modules = ['pycdio'],
test_suite = 'nose.collector',
url = 'http://freshmeat.net/projects/libcdio/?branch_id=62870',