Commit beecb1b1 authored by Romain Bignon's avatar Romain Bignon

add --modules to install modules

parent badab277
recursive-include modules *.py
recursive-include modules *.png
......@@ -57,12 +57,166 @@ def build_qt():
'all',
'PYUIC=%s%s' % (pyuic4, ' WIN32=1' if sys.platform == 'win32' else '')])
def install_weboob():
scripts = set(os.listdir('scripts'))
packages = set(find_packages(exclude=['modules']))
hildon_scripts = set(('masstransit',))
qt_scripts = set(('qboobmsg', 'qhavedate', 'qvideoob', 'weboob-config-qt', 'qwebcontentedit', 'qflatboob', 'qcineoob', 'qcookboob', 'qhandjoob'))
if not options.hildon:
scripts = scripts - hildon_scripts
if options.qt:
build_qt()
else:
scripts = scripts - qt_scripts
hildon_packages = set((
'weboob.applications.masstransit',
))
qt_packages = set((
'weboob.applications.qboobmsg',
'weboob.applications.qboobmsg.ui',
'weboob.applications.qcineoob',
'weboob.applications.qcineoob.ui',
'weboob.applications.qcookboob',
'weboob.applications.qcookboob.ui',
'weboob.applications.qhandjoob',
'weboob.applications.qhandjoob.ui',
'weboob.applications.qhavedate',
'weboob.applications.qhavedate.ui',
'weboob.applications.qvideoob',
'weboob.applications.qvideoob.ui',
'weboob.applications.qweboobcfg',
'weboob.applications.qweboobcfg.ui',
'weboob.applications.qwebcontentedit',
'weboob.applications.qwebcontentedit.ui'
'weboob.applications.qflatboob',
'weboob.applications.qflatboob.ui'
))
if not options.hildon:
packages = packages - hildon_packages
if not options.qt:
packages = packages - qt_packages
data_files = [
('share/man/man1', glob.glob('man/*')),
]
if options.xdg:
data_files.extend([
('share/applications', glob.glob('desktop/*')),
('share/icons/hicolor/64x64/apps', glob.glob('icons/*')),
])
# Do not put PyQt, it does not work properly.
requirements = [
'lxml',
'feedparser',
'mechanize',
'gdata',
'python-dateutil',
'PyYAML',
]
try:
import Image
except ImportError:
requirements.append('Pillow')
else:
if 'PILcompat' not in Image.__file__:
requirements.append('PIL')
else:
requirements.append('Pillow')
if sys.version_info[0] > 2:
print >>sys.stderr, 'Python 3 is not supported.'
sys.exit(1)
if sys.version_info[1] < 6: # older than 2.6
print >>sys.stderr, 'Python older than 2.6 is not supported.'
sys.exit(1)
if not options.deps:
requirements = []
setup(
name='weboob',
version='0.h',
description='Weboob, Web Outside Of Browsers',
long_description=open('README').read(),
author='Romain Bignon',
author_email='weboob@weboob.org',
maintainer='Romain Bignon',
maintainer_email='romain@weboob.org',
url='http://weboob.org/',
license='GNU AGPL 3',
classifiers=[
'Environment :: Console',
'Environment :: X11 Applications :: Qt',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python',
'Topic :: Communications :: Email',
'Topic :: Internet :: WWW/HTTP',
],
packages=packages,
scripts=[os.path.join('scripts', script) for script in scripts],
data_files=data_files,
install_requires=requirements,
)
def prepare_install_modules(func):
def inner(*args, **kwargs):
here = os.path.abspath(os.path.dirname(__file__))
try:
open(os.path.join(here, 'modules', '__init__.py'), 'w').close()
os.rename(os.path.join(here, 'MANIFEST.in'), os.path.join(here, 'MANIFEST.in.weboob'))
os.rename(os.path.join(here, 'MANIFEST.in.modules'), os.path.join(here, 'MANIFEST.in'))
return func(*args, **kwargs)
finally:
os.unlink(os.path.join(here, 'modules', '__init__.py'))
os.rename(os.path.join(here, 'MANIFEST.in'), os.path.join(here, 'MANIFEST.in.modules'))
os.rename(os.path.join(here, 'MANIFEST.in.weboob'), os.path.join(here, 'MANIFEST.in'))
return inner
@prepare_install_modules
def install_modules():
setup(
name='weboob-modules',
version='0.h',
description='Weboob modules',
long_description=open('README').read(),
author='Romain Bignon',
author_email='weboob@weboob.org',
maintainer='Romain Bignon',
maintainer_email='romain@weboob.org',
url='http://weboob.org/modules',
license='GNU AGPL 3',
classifiers=[
'Environment :: Console',
'Environment :: X11 Applications :: Qt',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python',
'Topic :: Communications :: Email',
'Topic :: Internet :: WWW/HTTP',
],
package_dir={'weboob_modules': 'modules'},
packages=['weboob_modules'],
include_package_data=True,
)
class Options(object):
hildon = False
qt = True
xdg = True
deps = True
modules = False
options = Options()
......@@ -103,114 +257,13 @@ if '--nodeps' in args:
options.deps = False
args.remove('--nodeps')
sys.argv = args
scripts = set(os.listdir('scripts'))
packages = set(find_packages())
if '--modules' in args:
options.modules = True
args.remove('--modules')
hildon_scripts = set(('masstransit',))
qt_scripts = set(('qboobmsg', 'qhavedate', 'qvideoob', 'weboob-config-qt', 'qwebcontentedit', 'qflatboob', 'qcineoob', 'qcookboob', 'qhandjoob'))
sys.argv = args
if not options.hildon:
scripts = scripts - hildon_scripts
if options.qt:
build_qt()
if options.modules:
install_modules()
else:
scripts = scripts - qt_scripts
hildon_packages = set((
'weboob.applications.masstransit',
))
qt_packages = set((
'weboob.applications.qboobmsg',
'weboob.applications.qboobmsg.ui',
'weboob.applications.qcineoob',
'weboob.applications.qcineoob.ui',
'weboob.applications.qcookboob',
'weboob.applications.qcookboob.ui',
'weboob.applications.qhandjoob',
'weboob.applications.qhandjoob.ui',
'weboob.applications.qhavedate',
'weboob.applications.qhavedate.ui',
'weboob.applications.qvideoob',
'weboob.applications.qvideoob.ui',
'weboob.applications.qweboobcfg',
'weboob.applications.qweboobcfg.ui',
'weboob.applications.qwebcontentedit',
'weboob.applications.qwebcontentedit.ui'
'weboob.applications.qflatboob',
'weboob.applications.qflatboob.ui'
))
if not options.hildon:
packages = packages - hildon_packages
if not options.qt:
packages = packages - qt_packages
data_files = [
('share/man/man1', glob.glob('man/*')),
]
if options.xdg:
data_files.extend([
('share/applications', glob.glob('desktop/*')),
('share/icons/hicolor/64x64/apps', glob.glob('icons/*')),
])
# Do not put PyQt, it does not work properly.
requirements = [
'lxml',
'feedparser',
'mechanize',
'gdata',
'python-dateutil',
'PyYAML',
]
try:
import Image
except ImportError:
requirements.append('Pillow')
else:
if 'PILcompat' not in Image.__file__:
requirements.append('PIL')
else:
requirements.append('Pillow')
if sys.version_info[0] > 2:
print >>sys.stderr, 'Python 3 is not supported.'
sys.exit(1)
if sys.version_info[1] < 6: # older than 2.6
print >>sys.stderr, 'Python older than 2.6 is not supported.'
sys.exit(1)
if not options.deps:
requirements = []
setup(
name='weboob',
version='0.h',
description='Weboob, Web Outside Of Browsers',
long_description=open('README').read(),
author='Romain Bignon',
author_email='weboob@weboob.org',
maintainer='Romain Bignon',
maintainer_email='romain@weboob.org',
url='http://weboob.org/',
license='GNU AGPL 3',
classifiers=[
'Environment :: Console',
'Environment :: X11 Applications :: Qt',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python',
'Topic :: Communications :: Email',
'Topic :: Internet :: WWW/HTTP',
],
packages=packages,
scripts=[os.path.join('scripts', script) for script in scripts],
data_files=data_files,
install_requires=requirements,
)
install_weboob()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment