Changeset 1645


Ignore:
Timestamp:
Sep 18, 2009 5:12:43 PM (11 years ago)
Author:
wehart
Message:

A reorg of Coopr to use namespace packages: coopr and coopr.plugins

NOTE: this commit is for a branch, which needs to be merged back
to the trunk.

Location:
branches/ns_dev
Files:
2 added
9 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/ns_dev/coopr/coopr/__init__.py

    r1633 r1645  
    2525"""
    2626
     27#
     28# NOTE: The coopr.coopr package provides a mechanism for managing stuff
     29# that is related to releases of the entire Coopr software.
     30#
     31
    2732from __release__ import __version__, __date__
    2833
  • branches/ns_dev/coopr/core/__init__.py

    r1296 r1645  
    1111import pyutilib.plugin
    1212
    13 pyutilib.plugin.PluginGlobals.push_env( "coopr.opt" )
     13try:
     14    import pkg_resources
     15    #
     16    # Load modules associated with Plugins that are defined in
     17    # EGG files.
     18    #
     19    for entrypoint in pkg_resources.iter_entry_points('coopr.opt'):
     20        plugin_class = entrypoint.load()
     21except:
     22    pass
     23
     24pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
    1425
    1526from base import *
  • branches/ns_dev/coopr/plugins/__init__.py

    r1297 r1645  
    99#  _________________________________________________________________________
    1010
    11 """
    12 This package contains plugins that depend on external utilities.
    13 """
     11# this is a namespace package
     12try:
     13    import pkg_resources
     14    pkg_resources.declare_namespace(__name__)
     15except ImportError:
     16    import pkgutil
     17    __path__ = pkgutil.extend_path(__path__, __name__)
    1418
    15 import pyutilib.plugin
    16 
    17 pyutilib.plugin.PluginGlobals.push_env( "coopr.opt" )
    18 
    19 import mip
    20 import converter
    21 import smanager
    22 
    23 pyutilib.plugin.PluginGlobals.pop_env()
     19#import pyutilib.plugin
     20#
     21#pyutilib.plugin.PluginGlobals.push_env( "coopr.opt" )
     22#
     23#import mip
     24#import converter
     25#import smanager
     26#
     27#pyutilib.plugin.PluginGlobals.pop_env()
  • branches/ns_dev/coopr/plugins/converter/__init__.py

    r1217 r1645  
    99#  _________________________________________________________________________
    1010
     11import pyutilib.plugin
     12pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     13
    1114import glpsol
    1215import pico
    1316import pyomo
     17
     18pyutilib.plugin.PluginGlobals.pop_env()
  • branches/ns_dev/coopr/plugins/mip/__init__.py

    r1217 r1645  
    99#  _________________________________________________________________________
    1010
     11import pyutilib.plugin
     12pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     13
    1114from PICO import PICO, MockPICO
    1215from CBC import CBC, MockCBC
     
    1417from CPLEX import CPLEX, MockCPLEX
    1518#from NLWRITE import NLWRITE
     19
     20pyutilib.plugin.PluginGlobals.pop_env()
  • branches/ns_dev/coopr/plugins/smanager/__init__.py

    r1297 r1645  
    99#  _________________________________________________________________________
    1010
     11import pyutilib.plugin
     12pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     13
    1114import pyro
     15
     16pyutilib.plugin.PluginGlobals.pop_env()
  • branches/ns_dev/coopr/pyomo/__init__.py

    r1254 r1645  
    1111import pyutilib.plugin
    1212
     13try:
     14    import pkg_resources
     15    #
     16    # Load modules associated with Plugins that are defined in
     17    # EGG files.
     18    #
     19    for entrypoint in pkg_resources.iter_entry_points('coopr.pyomo'):
     20        plugin_class = entrypoint.load()
     21except:
     22    pass
     23
     24
    1325pyutilib.plugin.PluginGlobals.push_env( "coopr.pyomo" )
    1426
  • branches/ns_dev/coopr/pysp/__init__.py

    r1559 r1645  
    1111import pyutilib.plugin
    1212
     13try:
     14    import pkg_resources
     15    #
     16    # Load modules associated with Plugins that are defined in
     17    # EGG files.
     18    #
     19    for entrypoint in pkg_resources.iter_entry_points('coopr.pysp'):
     20        plugin_class = entrypoint.load()
     21except:
     22    pass
     23
    1324pyutilib.plugin.PluginGlobals.push_env( "coopr.pysp" )
    1425
  • branches/ns_dev/coopr/sucasa/__init__.py

    r1217 r1645  
    99#  _________________________________________________________________________
    1010
     11try:
     12    import pkg_resources
     13    #
     14    # Load modules associated with Plugins that are defined in
     15    # EGG files.
     16    #
     17    for entrypoint in pkg_resources.iter_entry_points('coopr.sucasa'):
     18        plugin_class = entrypoint.load()
     19except:
     20    pass
     21
    1122#
    1223# Sucasa does not import any modules directly.
  • branches/ns_dev/setup.py

    r1561 r1645  
    1717"""
    1818
    19 import coopr
     19import coopr.coopr
    2020import glob
    2121import os
     
    4747
    4848scripts = glob.glob("scripts/*")
    49 doclines = coopr.__doc__.split("\n")
     49doclines = coopr.coopr.__doc__.split("\n")
    5050
    5151setup(name="Coopr",
    52       version=coopr.__version__,
    53       maintainer=coopr.__maintainer__,
    54       maintainer_email=coopr.__maintainer_email__,
    55       url = coopr.__url__,
    56       license = coopr.__license__,
     52      version=coopr.coopr.__version__,
     53      maintainer=coopr.coopr.__maintainer__,
     54      maintainer_email=coopr.coopr.__maintainer_email__,
     55      url = coopr.coopr.__url__,
     56      license = coopr.coopr.__license__,
    5757      platforms = ["any"],
    5858      description = doclines[0],
     
    6262      keywords=['optimization'],
    6363      scripts=scripts,
     64      namespace_packages=['coopr', 'coopr.plugins'],
     65      entry_points = {
     66        'coopr.opt': [
     67            'solvermanager.pyro = coopr.plugins.smanager.pyro',
     68            'converter.glpsol = coopr.plugins.converter.glpsol',
     69            'converter.pico = coopr.plugins.converter.pico',
     70            'converter.pyomo = coopr.plugins.converter.pyomo',
     71            'solver.cbc = coopr.plugins.mip.CBC',
     72            'solver.cplex = coopr.plugins.mip.CPLEX',
     73            'solver.pico = coopr.plugins.mip.PICO',
     74            'solver.glpk = coopr.plugins.mip.GLPK',
     75        ]
     76      },
    6477      install_requires=['PyUtilib>=2.1']
    6578      )
Note: See TracChangeset for help on using the changeset viewer.