def get_all_classes(root): """ Gets a generator with classes. :returns: a generator. """ # Convert to absolute path so it works within documentation tools basedir = os.path.dirname(stoqlib.__path__[0]) root = os.path.join(basedir, root) for package in listpackages(root): # Remove absolute path package = package[len(basedir):] if package.startswith('.'): package = package[1:] # stoqlib.domain -> stoqlib/domain package = package.replace('.', os.path.sep) # List all python files in stoqlib/domain for filename in glob.glob(os.path.join(package, '*.py')): # Avoid tests. if 'test/' in filename: continue # stoqlib/domain/base.py -> stoqlib.domain.base modulename = filename[:-3].replace(os.path.sep, '.') module = namedAny(modulename) for unused, klass in inspect.getmembers(module, inspect.isclass): yield klass
def get_all_classes(root, basedir=None): """ Gets a generator with classes. :param basedir: The directory from where the packages are being imported. :returns: a generator. """ # Convert to absolute path so it works within documentation tools if basedir is None: basedir = os.path.dirname(stoqlib.__path__[0]) root = os.path.join(basedir, root) for package in listpackages(root): # Remove absolute path package = package[len(basedir):] if package.startswith('.'): package = package[1:] # stoqlib.domain -> stoqlib/domain package = package.replace('.', os.path.sep) # List all python files in stoqlib/domain for filename in glob.glob(os.path.join(package, '*.py')): # Avoid tests. if 'pytests/' in filename or 'test/' in filename: continue # stoqlib/domain/base.py -> stoqlib.domain.base modulename = filename[:-3].replace(os.path.sep, '.') module = import_from_string(modulename) for unused, klass in inspect.getmembers(module, inspect.isclass): yield klass
def listplugins(plugins, exts): dirs = [] for package in listpackages('plugins'): # strip plugins dirs.append(package.replace('.', '/')) files = [] for directory in dirs: install_dir = 'share/stoq/%s' % directory files.append((install_dir, listfiles(directory, '*.py'))) files.append((install_dir, listfiles(directory, '*.plugin'))) for plugin in plugins: for kind, suffix in exts: x = listfiles('plugins', plugin, kind, suffix) if x: path = python_dir + '/plugins/%s/%s' files.append((path % (plugin, kind), x)) files.append((python_dir + 'plugins/' + plugin, listfiles('plugins', plugin, '*.py'))) return files
def listplugins(plugins, exts): dirs = [] for package in listpackages('plugins'): # strip plugins dirs.append(package.replace('.', '/')) files = [] for directory in dirs: install_dir = os.path.join(plugin_base_dir, directory) files.append((install_dir, listfiles(directory, '*.py'))) files.append((install_dir, listfiles(directory, '*.plugin'))) for plugin in plugins: for kind, suffix in exts: x = listfiles('plugins', plugin, kind, suffix) if x: path = os.path.join(plugin_dir, '%s', '%s') files.append((path % (plugin, kind), x)) files.append((os.path.join(plugin_dir, plugin), listfiles('plugins', plugin, '*.py'))) return files
def listplugins(plugins, exts): plugin_dir = os.path.join("$datadir", "plugins") dirs = [] for package in listpackages("plugins"): # strip plugins dirs.append(package.replace(".", "/")) files = [] for directory in dirs: install_dir = os.path.join("$datadir", directory) files.append((install_dir, listfiles(directory, "*.py"))) files.append((install_dir, listfiles(directory, "*.plugin"))) for plugin in plugins: for kind, suffix in exts: x = listfiles("plugins", plugin, kind, suffix) if x: path = os.path.join(plugin_dir, "%s", "%s") files.append((path % (plugin, kind), x)) files.append((os.path.join(plugin_dir, plugin), listfiles("plugins", plugin, "*.py"))) return files
def listplugins(plugins, exts): plugin_dir = os.path.join('$datadir', 'plugins') dirs = [] for package in listpackages('plugins'): # strip plugins dirs.append(package.replace('.', '/')) files = [] for directory in dirs: install_dir = os.path.join('$datadir', directory) files.append((install_dir, listfiles(directory, '*.py'))) files.append((install_dir, listfiles(directory, '*.plugin'))) for plugin in plugins: for kind, suffix in exts: x = listfiles('plugins', plugin, kind, suffix) if x: path = os.path.join(plugin_dir, '%s', '%s') files.append((path % (plugin, kind), x)) files.append((os.path.join(plugin_dir, plugin), listfiles('plugins', plugin, '*.py'))) return files
('$datadir/xml', listfiles('xml', '*.rng'))] resources = dict(locale='$prefix/share/locale') global_resources = dict( doc='$prefix/share/doc/sacam', glade='$datadir/glade', ) kwargs = {} scripts = ['bin/sacam'] templates.append(('share/applications', ['sacam.desktop'])) setup( name='sacam', version='1.0', description='Sistema de Analise Comportamental de Animais em Movimento' '/ Animal Motion Behavior Analysis System ', author='Luiz Carlos Irber Junior', author_email='*****@*****.**', url='http://repositorio.agrolivre.gov.br/projects/sacam/', license='GPL', # ext_modules = [videoprocessor], ext_modules=[cutils], packages=listpackages('sacam'), scripts=scripts, data_files=data_files, resources=resources, templates=templates, global_resources=global_resources, **kwargs)
return files def list_recursive(base_dir, extentions, prefix='$datadir'): files = [] base_dir = os.path.join(*base_dir.split('/')) for root, _, _ in os.walk(base_dir): parts = root.split(os.sep) _prefix = os.path.join(prefix, *parts[1:]) for ext in extentions: files.append((_prefix, listfiles(*(parts + [ext])))) return files packages = listpackages('stoq') packages.extend(listpackages('stoqlib', exclude='stoqlib.tests')) scripts = [ 'bin/stoq', 'bin/stoqdbadmin', ] data_files = [ ('$datadir/csv', listfiles('data', 'csv', '*.csv')), ('$datadir/csv/ibpt_tables', listfiles('data', 'csv', 'ibpt_tables', '*.csv')), ('$datadir/csv/cest', listfiles('data', 'csv', 'cest', '*.csv')), ('$datadir/glade', listfiles('data', 'glade', '*.ui')), ('$datadir/misc', listfiles('data/misc', '*.*')), ('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.png')), ('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.svg')),
# Code by Async Open Source <http://www.async.com.br> from kiwi.dist import setup, listpackages, listfiles from stoqdrivers import __version__ with open('requirements.txt') as f: install_requires = [ l.strip() for l in f.readlines() if l.strip() and not l.startswith('#') ] setup( name="stoqdrivers", version=".".join(map(str, __version__)), author="Async Open Source", author_email="*****@*****.**", description="Python fiscal printer (ECF) drivers", long_description=("This package provices device drivers " "for fiscal printers, ECF (Emissor de Coupon Fiscal) " "written in Python. Supports printers from Bematech, " "Daruma, Dataregis, Perto, Sweda and the generic " "FiscNET protocol."), url="http://www.stoq.com.br", license="GNU LGPL 2.1 (see COPYING)", packages=listpackages('stoqdrivers'), data_files=[("$datadir/conf", listfiles("stoqdrivers/conf", "*.ini"))], global_resources=dict(conf="$datadir/conf"), resources=dict(locale="$prefix/share/locale"), install_requires=install_requires, )
return files def list_templates(): files = [] dir_prefix = '$datadir/' for root, _, _ in os.walk('data/template'): parts = root.split(os.sep) files.append((dir_prefix + os.sep.join(parts[1:]), listfiles(*(parts + ['*html'])))) files.append((dir_prefix + os.sep.join(parts[1:]), listfiles(*(parts + ['*css'])))) return files packages = listpackages('stoq') packages.extend(listpackages('stoqlib', exclude='stoqlib.tests')) scripts = [ 'bin/stoq', 'bin/stoqdbadmin', # FIXME: move these to /usr/lib/stoq/ 'bin/stoqcreatedbuser', 'bin/stoq-daemon', ] data_files = [ ('$datadir/csv', listfiles('data', 'csv', '*.csv')), ('$datadir/glade', listfiles('data', 'glade', '*.ui')), ('$datadir/misc', listfiles('data/misc', '*.*')), ('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.png')),
('$datadir/htsql', listfiles('data', 'htsql', '*.yml')), ] if 'bdist_egg' not in sys.argv and platform.system() != "Windows": data_files.extend([ ('/etc/sudoers.d', [os.path.join('data', 'sudoers.d', 'stoqserver')]), ('/etc/supervisor/conf.d', [os.path.join('data', 'supervisor', 'stoqserver.conf')]), ]) with open('requirements.txt') as f: install_requires = [l.strip() for l in f.readlines() if l.strip() and not l.startswith('#')] setup( name=PACKAGE, author="Stoq Team", author_email="*****@*****.**", description="Stoq server", url="http://www.stoq.com.br", license="GNU LGPL 2.1 (see COPYING)", long_description=("Service that provides a bridge between Stoq and " "stoq.link, along with other usefullnesses."), version=stoqserver.version_str, packages=listpackages('stoqserver'), data_files=data_files, install_requires=install_requires, scripts=scripts, zip_safe=True, )
files.append((os.path.join(plugin_dir, plugin), listfiles("plugins", plugin, "*.py"))) return files def list_templates(): files = [] dir_prefix = "$datadir/" for root, _, _ in os.walk("data/template"): parts = root.split(os.sep) files.append((dir_prefix + os.sep.join(parts[1:]), listfiles(*(parts + ["*html"])))) files.append((dir_prefix + os.sep.join(parts[1:]), listfiles(*(parts + ["*css"])))) return files packages = listpackages("ellite") packages.extend(listpackages("ellitelib", exclude="ellitelib.tests")) scripts = ["bin/ellite", "bin/ellitedbadmin"] data_files = [ ("$datadir/csv", listfiles("data", "csv", "*.csv")), ("$datadir/csv/ibpt_tables", listfiles("data", "csv", "ibpt_tables", "*.csv")), ("$datadir/glade", listfiles("data", "glade", "*.ui")), ("$datadir/misc", listfiles("data/misc", "*.*")), ("$datadir/pixmaps", listfiles("data", "pixmaps", "*.png")), ("$datadir/pixmaps", listfiles("data", "pixmaps", "*.svg")), ("$datadir/pixmaps", listfiles("data", "pixmaps", "*.jpg")), ("$datadir/pixmaps", listfiles("data", "pixmaps", "*.gif")), ("$datadir/pixmaps", listfiles("data", "pixmaps", "*.bmp")), ("$datadir/scripts", listfiles("data", "scripts", "*.sh")), ("$datadir/sql", listfiles("data", "sql", "*.sql")),
# # Package installation # from kiwi.dist import setup, listpackages, listfiles from stoqdrivers import __version__ setup( name="stoqdrivers", version= ".".join(map(str, __version__)), author="Async Open Source", author_email="*****@*****.**", description="Python fiscal printer (ECF) drivers", long_description=("This package provices device drivers " "for fiscal printers, ECF (Emissor de Coupon Fiscal) " "written in Python. Supports printers from Bematech, " "Daruma, Dataregis, Perto, Sweda and the generic " "FiscNET protocol."), url="http://www.stoq.com.br", license="GNU LGPL 2.1 (see COPYING)", packages=listpackages('stoqdrivers'), data_files=[ ("$datadir/conf", listfiles("stoqdrivers/conf", "*.ini"))], global_resources=dict(conf="$datadir/conf"), resources=dict(locale="$prefix/share/locale"), install_requires="kiwi-gtk >= 1.9.28", )
l.strip() for l in f.readlines() if l.strip() and not l.startswith('#') ] setup( name=name, packagename='kiwi', version=".".join(map(str, kiwi_version)), description="A framework and a set of enhanced widgets based on PyGTK", long_description=__doc__, author="Async Open Source", author_email="*****@*****.**", url="http://www.async.com.br/projects/kiwi/", license="GNU LGPL 2.1 (see COPYING)", data_files=[ # Data ('$datadir/css', ['data/css/kiwi.css']), # Glade3 ('share/glade3/catalogs', ['data/kiwiwidgets/kiwiwidgets.xml']), ('$libdir/glade3/modules', ['data/kiwiwidgets/kiwiwidgets.py']), ('share/glade3/pixmaps', pixmaps), # Documentation ('share/doc/kiwi', ('AUTHORS', 'NEWS', 'README')), ('share/doc/kiwi/howto', listfiles('doc/howto/', '*')), ('share/doc/kiwi/api', listfiles('doc/api/', '*')), ], scripts=['bin/kiwi-i18n', 'bin/kiwi-ui-test'], packages=listpackages('kiwi'), test_requires=['mock'], install_requires=install_requires, )
l.strip() and not l.startswith('#')] setup(name=name, packagename='kiwi', version=".".join(map(str, kiwi_version)), description="A framework and a set of enhanced widgets based on PyGTK", long_description=__doc__, author="Async Open Source", author_email="*****@*****.**", url="http://www.async.com.br/projects/kiwi/", license="GNU LGPL 2.1 (see COPYING)", data_files=[ # Glade3 ('share/glade3/catalogs', ['data/kiwiwidgets/kiwiwidgets.xml']), ('$libdir/glade3/modules', ['data/kiwiwidgets/kiwiwidgets.py']), ('share/glade3/pixmaps', pixmaps), # Documentation ('share/doc/kiwi', ('AUTHORS', 'NEWS', 'README')), ('share/doc/kiwi/howto', listfiles('doc/howto/', '*')), ('share/doc/kiwi/api', listfiles('doc/api/', '*')), ], scripts=['bin/kiwi-i18n', 'bin/kiwi-ui-test'], packages=listpackages('kiwi'), test_requires=['mock'], install_requires=install_requires, )
PACKAGE = 'stoqserver' scripts = [ 'bin/stoqserver', ] data_files = [ (os.path.join(os.sep, 'etc', 'supervisor', 'conf.d'), [os.path.join('data', 'supervisor', 'stoqserver.conf')]), (os.path.join(os.sep, 'usr', 'share', 'stoqserver', 'webrtc'), [os.path.join('data', 'webrtc', 'package.json'), os.path.join('data', 'webrtc', 'rtc.js'), os.path.join('data', 'webrtc', 'start.sh')]) ] with open('requirements.txt') as f: install_requires = [l.strip() for l in f.readlines() if l.strip() and not l.startswith('#')] setup( name=PACKAGE, author="Stoq Team", author_email="*****@*****.**", version=".".join(str(i) for i in stoqserver.__version__), packages=listpackages('stoqserver'), data_files=data_files, install_requires=install_requires, scripts=scripts, zip_safe=True, )
# Setup file for StoqDrivers # Code by Async Open Source <http://www.async.com.br> from kiwi.dist import setup, listpackages, listfiles from stoqdrivers import __version__ with open("requirements.txt") as f: install_requires = [l.strip() for l in f.readlines() if l.strip() and not l.startswith("#")] setup( name="stoqdrivers", version=".".join(map(str, __version__)), author="Async Open Source", author_email="*****@*****.**", description="Python fiscal printer (ECF) drivers", long_description=( "This package provices device drivers " "for fiscal printers, ECF (Emissor de Coupon Fiscal) " "written in Python. Supports printers from Bematech, " "Daruma, Dataregis, Perto, Sweda and the generic " "FiscNET protocol." ), url="http://www.stoq.com.br", license="GNU LGPL 2.1 (see COPYING)", packages=listpackages("stoqdrivers"), data_files=[("$datadir/conf", listfiles("stoqdrivers/conf", "*.ini"))], install_requires=install_requires, )