checkenv.py :  » Game-2D-3D » CGKit » cgkit-2.0.0alpha9 » utilities » 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 » Game 2D 3D » CGKit 
CGKit » cgkit 2.0.0alpha9 » utilities » checkenv.py
#!/usr/bin/env python
######################################################################
# Check if everything is installed to run cgkit
######################################################################

import sys

VER_PLATFORM_WIN32s = 0
VER_PLATFORM_WIN32_WINDOWS = 1
VER_PLATFORM_WIN32_NT = 2
VER_PLATFORM_WIN32_CE = 3

print 70*"-"
print "Python",sys.version

# Print platform information
if sys.platform=="win32":
    try:
        major, minor, build, platform, text = sys.getwindowsversion()
        if platform==VER_PLATFORM_WIN32s:
            plat = "Windows 3.1"
        elif platform==VER_PLATFORM_WIN32_WINDOWS:
            plat = "Windows 95/98/ME"
        elif platform==VER_PLATFORM_WIN32_NT:
            plat = "Windows NT/2000/XP"
        elif platform==VER_PLATFORM_WIN32_CE:
            plat = "Windows CE"
        else:
            plat = str(platform)
    except:
        plat = None

    print "Platform: %s"%sys.platform,
    if plat!=None:
        print "(%s)"%plat
        print "          Windows %d.%d (Build %d) %s"%(major, minor, build, text)
    else:
        print ""
else:
    print "Platform:",sys.platform

print 70*"-"

def chkmsg(txt):
    dots = (30-len(txt))*"."
    print "%s%s"%(txt, dots),

# Check Python version
vi = sys.version.split()[0].split(".")
try:
    major = int(vi[0])
    minor = int(vi[1])
except:
    major = 0
    minor = 0
chkmsg("Python version: %d.%d"%(major, minor))
if (major>2) or (major==2 and minor>=3):
    print "OK"
else:
    print "unsupported"
    print """
You are using an unsupported version of Python. It is recommended that
you upgrade to a more recent version. Some basic modules might still
work but it is quite likely that there are other parts that will not
work as expected.
"""

# Check PyProtocols
chkmsg("PyProtocols")
try:
    import protocols
    print "is installed"
except:
    print "missing"
    print """
PyProtocols is not installed. This package is required as soon as you are
using the cgkit scene management stuff (for example, as soon as you want
to use the viewer or render tool). You can get PyProtocols at this site:
http://peak.telecommunity.com/PyProtocols.html
"""

# Check PyOpenGL
chkmsg("PyOpenGL")
try:
    import OpenGL.GL
    print "is installed"
except:
    print "missing"
    print """
PyOpenGL is not installed. You will still be able to use the viewer tool
as most geometric objects are implemented in C++. Some objects that are
implemented in Python may raise an exception if you are attempting to
visualize them. You can obtain PyOpenGL at http://pyopengl.sourceforge.net/
"""

# Check PIL
chkmsg("PIL")
try:
    import Image
    print "is installed"
except:
    print "missing"
    print """
The Python Imaging Library (PIL) is missing. This package is required
whenever images have to be processed (for example, when using texture
maps or taking screenshots). You can get PIL at
http://www.pythonware.com/products/pil/index.htm
"""
    
# Check numarray
#try:
#    import numarray
#    numarray_installed = True
#except:
#    numarray_installed = False

# Check pygame
chkmsg("pygame")
try:
    import pygame
    print "is installed"
except:
    print "missing"
    print """
pygame is not installed. You can use cgkit in your own applications but
you will not be able to use the viewer tool. You can get pygame at 
http://www.pygame.org/
"""

# Check PyODE
chkmsg("PyODE")
try:
    import ode
    print "is installed"
except:
    print "missing"
    print """
The Python bindings of the Open Dynamics Engine (ODE) are not installed.
You will not be able to use the ODEDynamics component to do rigid body
simulations. You can get PyODE at http://pyode.sourceforge.net/
"""

# Check PySerial
chkmsg("PySerial")
try:
    import serial
    print "is installed"
except:
    print "missing"
    print """
PySerial is not installed. This module is only required for accessing
an Ascension Flock Of Bird motion tracker. You can get the module at
http://pyserial.sourceforge.net/
"""

# cgkit
chkmsg("cgkit (base)")
try:
    import cgkit.cgkitinfo
    print cgkit.cgkitinfo.version
except:
    print "missing"

chkmsg("cgkit (C++ lib)")
try:
    import cgkit._core
    print "OK"
except:
    print "failed"
    print """
The cgkit supportlib could not be imported. One possible reason for that
is that shared libraries (such as the boost_python runtime or OpenGL)
could not be found.
"""

chkmsg("cgkit (all)")
try:
    import cgkit.all
    print "OK"
except:
    print "failed"
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.