On Jan 09, Davide Alberani <davide.alber...@gmail.com> wrote:
> But, doing the change, it would make sense to use its features
> like the list of requirements and optional dependencies.
I'm still not confident enough to commit it to the SVN, but in
the attachments there are the first drafts of the new setup.py
and setup.cfg files.
They are commented with my doubts - if anyone knows how
setuptools work...
My main concern is with optional dependencies: being IMDbPY
exceptionally kind with its environment, it can work with
(almost) no deps at all.
I'm not sure how to specify it.
The "problem" involves 'lxml' (optionally required - but heavily
suggested) by 'http' and SQLObject _OR_ SQLAlchemy for 'local'.
Notice that either SQLObject _OR_ SQLAlchemy is enough, but I
don't know how to specify it.
Anyway, I suppose it's not a real problem (especially if we can
add, for these deps, command line switches like --without-lxml and
so on).
As a last note: I've _not_ tested it at all, especially the
download of missing dependencies (I've everything and more
installed).
PS: you must add the usual ez_setup.py file and remove MANIFEST.in
--
Davide Alberani <davide.alber...@gmail.com> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/
#!/usr/bin/env python
import ez_setup
ez_setup.use_setuptools()
import setuptools
# version of the software; in SVN this represents the _next_ release.
# setuptools will automatically add 'dev-rREVISION'.
version = '4.0'
home_page = 'http://imdbpy.sf.net/'
long_desc = """IMDbPY is a Python package useful to retrieve and
manage the data of the IMDb movie database about movies, people,
characters and companies.
Platform-independent and written in pure Python (and few C lines),
it can retrieve data from both the IMDb's web server and a local copy
of the whole database.
IMDbPY package can be very easily used by programmers and developers
to provide access to the IMDb's data to their programs.
Some simple example scripts - useful for the end users - are included
in this package; other IMDbPY-based programs are available at the
home page: %s
""" % home_page
dwnl_url = 'http://imdbpy.sf.net/?page=download'
classifiers = """\
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Environment :: Handhelds/PDA's
Intended Audience :: Developers
Intended Audience :: End Users/Desktop
License :: OSI Approved :: GNU General Public License (GPL)
Natural Language :: English
Programming Language :: Python
Programming Language :: C
Operating System :: OS Independent
Topic :: Database :: Front-Ends
Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries
Topic :: Software Development :: Libraries :: Python Modules
"""
keywords = ['imdb', 'movie', 'people', 'database', 'cinema', 'film', 'person',
'cast', 'actor', 'actress', 'director', 'sql', 'character',
'company', 'svn', 'package', 'plain text data files']
# XXX: is it possible to make this optional?
install_requires = ['lxml']
# XXX: remembering that IMDbPY is so kind to work even without it,
# is there a way to go on anyway, is the compiler fails?
cutils = setuptools.Extension('imdb.parser.common.cutils',
['imdb/parser/common/cutils.c'])
scripts = ['./bin/characters4local.py', './bin/companies4local.py',
'./bin/mpaa4local.py', './bin/misc-companies4local.py',
'./bin/imdbpy2sql.py', './bin/get_first_movie.py',
'./bin/get_movie.py', './bin/search_movie.py',
'./bin/get_first_person.py', './bin/get_person.py',
'./bin/search_person.py', './bin/get_character.py',
'./bin/get_first_character.py', './bin/get_company.py',
'./bin/search_character.py', './bin/search_company.py',
'./bin/get_first_company.py']
# XXX: I'm not sure that 'etc' is a good idea. Making it an absolute
# path seem a recipe for a disaster (with bdist_egg, at least).
data_files = [('doc', [f for f in setuptools.findall('docs')
if '.svn' not in f]), ('etc', ['docs/imdbpy.cfg'])]
# Defining these 'features', it's possible to run commands like:
# python ./setup.py --without-sql --without-local bdist
# having (in this example) imdb.parser.sql, imdb.parser.local and
# imdb.parser.common removed.
# XXX: is there a way to remove related scripts, along with the
# package? I.e.: for 'local': characters4local.py, companies4local.py,
# misc-companies4local.py, mpaa4local.py. For 'sql': imdbpy2sql.py.
featCommon = setuptools.dist.Feature('common code for "sql" and "local"',
standard=False, remove='imdb.parser.common')
featSQL = setuptools.dist.Feature('access to SQL databases', standard=True,
require_features='common', remove='imdb.parser.sql')
featLocal = setuptools.dist.Feature('access to local mkdb data', standard=True,
require_features='common', remove='imdb.parser.local')
features = {
'common': featCommon,
'sql': featSQL,
'local': featLocal
}
# XXX: it seems there's no way to specify that we needs either
# SQLObject OR SQLAlchemy.
# And I'm not even sure this is the correct place to specify this
# dependency.
extras_require = {
'sql': ['SQLObject', 'SQLAlchemy'],
}
params = {
# Meta-information.
'name': 'IMDbPY',
'version': version,
'description': 'Python package to access the IMDb\'s database',
'long_description': long_desc,
'author': 'Davide Alberani',
'author_email': 'd...@erlug.linux.it',
'contact': 'IMDbPY-devel mailing list',
'contact_email': 'imdbpy-devel@lists.sourceforge.net',
'maintainer': 'Davide Alberani',
'maintainer_email': 'd...@erlug.linux.it',
'license': 'GPL',
'platforms': 'any',
'keywords': keywords,
'classifiers': filter(None, classifiers.split("\n")),
'zip_safe': True, # XXX: I guess...
# Download URLs.
'url': home_page,
'download_url': dwnl_url,
# Scripts.
'scripts': scripts,
# Documentation files.
'data_files': data_files,
# C extensions.
'ext_modules': [cutils],
# Requirements.
'install_requires': install_requires,
'extras_require': extras_require,
'features': features,
# Packages.
'packages': setuptools.find_packages()
}
setuptools.setup(**params)
[egg_info]
tag_build = dev
tag_svn_revision = true
# XXX: use?
[easy_install]
find_links = http://imdbpy.sf.net/?page=download
[bdist_rpm]
vendor = Davide Alberani <d...@erlug.linux.it>
# Comment out the doc_files entry if you don't want to install
# the documentation.
doc_files = docs/*
# Comment out the icon entry if you don't want to install the icon.
icon = docs/imdbpyico.xpm
[bdist_wininst]
# Bitmap for the installer.
bitmap = docs/imdbpywin.bmp
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel