setup.py :  » Web-Services » python-xmltv » pytvgrab-lib-0.5.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 » Web Services » python xmltv 
python xmltv » pytvgrab lib 0.5.1 » setup.py
#!/usr/bin/env python
from distutils.core import setup
from distutils.dist import DistributionMetadata
import sys
import os

# Hoping this will temporarly change the language to English for my unit tests
# to pass.  And get the thing to install - then the user can set LC_ALL to
# whatever they wish once it has been installed.
# XXX .... no idea if this will work!
os.environ['LC_ALL']='C'

# The package source code directory
package_dir='lib'

# Import the package
package=__import__(package_dir)

# Populate the setup_args based on what's available
# on this system
setup_args={
  'package_dir' : {package.__name__: package_dir},
  'packages'    : [package.__name__],
}
for name in DistributionMetadata._METHOD_BASENAMES:
  key='__%s__' % name
  if package.__dict__.has_key(key):
    setup_args[name]=package.__dict__[key]

# Make sure the distribution gets the correct name
setup_args['name']=package.__dist_name__

# Find locale files:
setup_args[ "data_files" ] = []
def po_find( result, dirname, fnames ):
  files = []
  for f in fnames:
    p = os.path.join( dirname, f )
    if os.path.isfile( p ) and f.endswith( ".mo" ):
      files.append( p )

  if files:
    result.append( ( dirname, files ) )
# po_find()
os.path.walk( "share/locale", po_find, setup_args[ "data_files" ] )

# Run unit test cases
# NB. This now includes a bold attempt to run unit tests on all systems
# (ie. including Windows).
if os.name == 'posix' or True:
  os.chdir('lib')
  err=os.system('python -c "import grab, customizedparser, re2, timezone"') # XXX Specific to this package
  os.chdir('..')
  if err:
    debug_info=setup_args.copy()
    debug_info.update(
        {'os_name': os.name,
         'sys_platform': sys.platform,
         'sys_version_info': sys.version_info,
         'sys_version': sys.version,
         'bugreport_url': package.__bugreport_url__,
         }
    )
    sys.stderr.write("""
ERROR: %(name)s failed to install on your system.
  os_name          = %(os_name)s
  sys_platform     = %(sys_platform)s
  sys_version_info = %(sys_version_info)s
  sys_version      = %(sys_version)s

  Please submit a bug report including details of your system
  and the failed test cases shown above to:

  %(bugreport_url)s

""" % debug_info)
    sys.exit(1)

# Now finally, run the setup() using the setup_args
setup(**setup_args)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.