add --modules to install modules
This commit is contained in:
parent
badab27702
commit
beecb1b189
2 changed files with 163 additions and 108 deletions
2
MANIFEST.in.modules
Normal file
2
MANIFEST.in.modules
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
recursive-include modules *.py
|
||||||
|
recursive-include modules *.png
|
||||||
269
setup.py
269
setup.py
|
|
@ -57,12 +57,166 @@ def build_qt():
|
||||||
'all',
|
'all',
|
||||||
'PYUIC=%s%s' % (pyuic4, ' WIN32=1' if sys.platform == 'win32' else '')])
|
'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):
|
class Options(object):
|
||||||
hildon = False
|
hildon = False
|
||||||
qt = True
|
qt = True
|
||||||
xdg = True
|
xdg = True
|
||||||
deps = True
|
deps = True
|
||||||
|
modules = False
|
||||||
|
|
||||||
options = Options()
|
options = Options()
|
||||||
|
|
||||||
|
|
@ -103,114 +257,13 @@ if '--nodeps' in args:
|
||||||
options.deps = False
|
options.deps = False
|
||||||
args.remove('--nodeps')
|
args.remove('--nodeps')
|
||||||
|
|
||||||
|
if '--modules' in args:
|
||||||
|
options.modules = True
|
||||||
|
args.remove('--modules')
|
||||||
|
|
||||||
sys.argv = args
|
sys.argv = args
|
||||||
|
|
||||||
scripts = set(os.listdir('scripts'))
|
if options.modules:
|
||||||
packages = set(find_packages())
|
install_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:
|
else:
|
||||||
scripts = scripts - qt_scripts
|
install_weboob()
|
||||||
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue