from webpage import WebPage # Check for required software for name, import_path, reason in [ ("poppler", "itools.pdf.pdftotext", "PDF indexation"), ("wv2", "itools.office.doctotext", "DOC indexation"), ("xlrd", "xlrd", "XLS indexation")]: try: __import__(import_path) except ImportError: print '%s: You need to install "%s" and reinstall itools.' % (reason, name) # The version __version__ = get_version() # Import required modules import users # Register the itools domain path = get_abspath('locale') register_domain('ikaaro', path) # Register document types register_document_type(WebPage) register_document_type(Folder) register_document_type(File)
# -*- coding: UTF-8 -*- # Copyright (C) 2009 Juan David Ibáñez Palomar <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import get_version # Import from usine from config import config from hosts import remote_hosts from modules import modules, register_module import modules_instance import modules_source __version__ = get_version() __all__ = ['config', 'modules', 'register_module', 'remote_hosts']
def setup(ext_modules=freeze([])): mname = _getframe(1).f_globals.get('__name__') version = get_version(mname) config = get_config() # Initialize variables package_name = config.get_value('name') packages = [package_name] package_data = {package_name: []} # The sub-packages if config.has_value('packages'): subpackages = config.get_value('packages') for subpackage_name in subpackages: packages.append('%s.%s' % (package_name, subpackage_name)) else: subpackages = [] # Write the manifest file if it does not exist if exists('MANIFEST'): filenames = [ x.strip() for x in open('MANIFEST').readlines() ] else: filenames = get_manifest() lines = [ x + '\n' for x in filenames ] open('MANIFEST', 'w').write(''.join(lines)) # Python files are included by default filenames = [ x for x in filenames if not x.endswith('.py') ] # The data files for line in filenames: path = line.split('/') n = len(path) if path[0] in subpackages: subpackage = '%s.%s' % (package_name, path[0]) files = package_data.setdefault(subpackage, []) files.append(join_path(*path[1:])) elif path[0] not in ('scripts', 'test'): package_data[package_name].append(line) # The scripts if config.has_value('scripts'): scripts = config.get_value('scripts') scripts = [ join_path(*['scripts', x]) for x in scripts ] else: scripts = [] author_name = config.get_value('author_name') # XXX Workaround buggy distutils ("sdist" don't likes unicode strings, # and "register" don't likes normal strings). if 'register' in argv: author_name = unicode(author_name, 'utf-8') classifiers = [ x for x in config.get_value('classifiers') if x ] core.setup(name = package_name, version = version, # Metadata author = author_name, author_email = config.get_value('author_email'), license = config.get_value('license'), url = config.get_value('url'), description = config.get_value('title'), long_description = config.get_value('description'), classifiers = classifiers, # Packages package_dir = {package_name: ''}, packages = packages, package_data = package_data, # Requires / Provides requires = config.get_value('requires'), provides = config.get_value('provides'), # Scripts scripts = scripts, cmdclass = {'build_ext': OptionalBuildExt}, # C extensions ext_modules=ext_modules)
def setup(ext_modules=freeze([])): mname = _getframe(1).f_globals.get('__name__') version = get_version(mname) config = get_config() # Initialize variables package_name = config.get_value('name') packages = [package_name] package_data = {package_name: []} # The sub-packages if config.has_value('packages'): subpackages = config.get_value('packages') for subpackage_name in subpackages: packages.append('%s.%s' % (package_name, subpackage_name)) else: subpackages = [] # Write the manifest file if it does not exist if exists('MANIFEST'): filenames = [x.strip() for x in open('MANIFEST').readlines()] else: filenames = get_manifest() lines = [x + '\n' for x in filenames] open('MANIFEST', 'w').write(''.join(lines)) # Python files are included by default filenames = [x for x in filenames if not x.endswith('.py')] # The data files for line in filenames: path = line.split('/') n = len(path) if path[0] in subpackages: subpackage = '%s.%s' % (package_name, path[0]) files = package_data.setdefault(subpackage, []) files.append(join_path(*path[1:])) elif path[0] not in ('scripts', 'test'): package_data[package_name].append(line) # The scripts if config.has_value('scripts'): scripts = config.get_value('scripts') scripts = [join_path(*['scripts', x]) for x in scripts] else: scripts = [] author_name = config.get_value('author_name') # XXX Workaround buggy distutils ("sdist" don't likes unicode strings, # and "register" don't likes normal strings). if 'register' in argv: author_name = unicode(author_name, 'utf-8') classifiers = [x for x in config.get_value('classifiers') if x] core.setup( name=package_name, version=version, # Metadata author=author_name, author_email=config.get_value('author_email'), license=config.get_value('license'), url=config.get_value('url'), description=config.get_value('title'), long_description=config.get_value('description'), classifiers=classifiers, # Packages package_dir={package_name: ''}, packages=packages, package_data=package_data, # Requires / Provides requires=config.get_value('requires'), provides=config.get_value('provides'), # Scripts scripts=scripts, cmdclass={'build_ext': OptionalBuildExt}, # C extensions ext_modules=ext_modules)