setup.py :  » Development » Python-Dispatcher » PyDispatcher-2.0.1 » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » Python Dispatcher 
Python Dispatcher » PyDispatcher 2.0.1 » setup.py
#!/usr/bin/env python
"""Installs PyDispatcher using distutils

Run:
  python setup.py install
to install the package from the source archive.
"""

if __name__ == "__main__":
  import sys,os, string, fnmatch
  from distutils.sysconfig import *
  from distutils.core import setup

  ##############
  ## Following is from Pete Shinners,
  ## apparently it will work around the reported bug on
  ## some unix machines where the data files are copied
  ## to weird locations if the user's configuration options
  ## were entered during the wrong phase of the moon :) .
  from distutils.command.install_data import install_data
  class smart_install_data(install_data):
    def run(self):
      #need to change self.install_dir to the library dir
      install_cmd = self.get_finalized_command('install')
      self.install_dir = getattr(install_cmd, 'install_lib')
      # should create the directory if it doesn't exist!!!
      return install_data.run(self)
  ##############
  ### The following automates the inclusion of files while avoiding problems with UNIX
  ### where case sensitivity matters.
  dataFiles = []
  excludedTypes = ('.py','.pyc','.pyo','.db','.gz','.bat', ".cvsignore")
  excludedDirectories = ('build','dist','cvs')
  def nonPythonFile( file ):
    """Is the fully-qualified name a non-python file"""
    if os.path.isfile( file ):
      return (os.path.splitext( file )[1]).lower() not in excludedTypes
  def directoryWalker( argument, directory, files, prefix = "pydispatch"):
    """Walk the particular directory searching for non-python files

    prefix -- prefix directory appended to the destination
      directories, normally the name of the target package
    """
    if os.path.split(directory.lower())[-1] in excludedDirectories:
      return
    result = []
    for file in files:
      file = os.path.join(directory,file )
      if nonPythonFile( file ):
        result.append( file )
    if result:
      argument.append((os.path.join(prefix,directory), result))
  os.path.walk( '.', directoryWalker, dataFiles)

  from sys import hexversion
  if hexversion >= 0x2030000:
    # work around distutils complaints under Python 2.2.x
    extraArguments = {
      'classifiers': [
        """License :: OSI Approved :: BSD License""",
        """Programming Language :: Python""",
        """Topic :: Software Development :: Libraries :: Python Modules""",
        """Intended Audience :: Developers""",
      ],
      'download_url': "https://sourceforge.net/project/showfiles.php?group_id=79755",
      'keywords': 'dispatcher,dispatch,pydispatch,event,signal,sender,receiver,propagate,multi-consumer,multi-producer,saferef,robustapply,apply',
      'long_description' : """Dispatcher mechanism for creating event models

PyDispatcher is an enhanced version of Patrick K. O'Brien's
original dispatcher.py module.  It provides the Python
programmer with a robust mechanism for event routing within
various application contexts.

Included in the package are the robustapply and saferef
modules, which provide the ability to selectively apply
arguments to callable objects and to reference instance
methods using weak-references.
""",
      'platforms': ['Any'],
    }
  else:
    extraArguments = {
    }

  ### Now the actual set up call
  setup (
    name = "PyDispatcher",
    version = "2.0.1",
    description= "Multi-producer-multi-consumer signal dispatching mechanism",
    author = "Patrick K. O'Brien",
    author_email = "pydispatcher-devel@lists.sourceforge.net",
    url = "http://pydispatcher.sourceforge.net",
    license = "BSD-style, see license.txt for details",

    package_dir = {
      'pydispatch':'.',
    },

    packages = [
      'pydispatch', 
      'pydispatch.tests',
      'pydispatch.examples',
    ],
    
    options = {
      'sdist':{'use_defaults':0, 'force_manifest':1},
      "install_lib":{"compile":0, "optimize":0},
      'bdist_rpm':{
        'group':'Libraries/Python',
        'provides':'python-dispatcher',
        'requires':"python",
      },
    },
    data_files = dataFiles,
    cmdclass = {'install_data':smart_install_data},

    # registration metadata
    **extraArguments
  )
  
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.