You are on page 1of 6

Codigo Python Minesight

"""Displays MSGRAIL/Python information to the MS3D message window.

------------

Dependencies

------------

::

Python: 2.2.[3-*]

MineSight 3D: 4.[00-*].*

MineSight Grail: 4.[00-*].*

----------------

Revision History

----------------

18.11.2008, v4.50

- Updated to remove references to the PYTHONPATH and PYTHONHOME

variables. These are no longer used by MS3D, starting with v4.50.

Instead report the sys.prefix, sys.path and sys.executable contents,

because these are the most important configuration parameters.

19.06.2007, v4.50, REF#5172

- Updated to display the contents of the python "sys.path".

23.04.2007, v3.70, REF#7323

- Upgraded script to use the new grail.info module.


25.02.2007, v3.70, REF#7155

- Added MS3D Version info to the script.

- Removed old style of redirecting to the print statement.

--------------------------

User Configuration Options

--------------------------

If the configuration options are changed, this script should be saved

under a new name to prevent your setting from being overwritten when new

releases are installed.

-----------------

License Agreement

-----------------

The Original Code is em-info.py.

Copyright (C) 2014 Leica Geosystems. All Rights Reserved.

MineSight(R) is a registered trademark of Leica Geosystems.

"""

import sys

import os
from grail.ms3d import mssys

from grail import gsys

from grail import info

from grail import libconfig

class Struct:

pass

def ms3d_config():

if mssys.IS_DEBUG:

return "DEBUG"

else:

return "RELEASE"

def make_torque_version(mstorque_api):

version = Struct()

version.built_with = "%d.%d.%d (build %d)" \

%(

mstorque_api.MsdhVERSION_MAJOR,

mstorque_api.MsdhVERSION_MINOR,

mstorque_api.MsdhVERSION_PATCH,

mstorque_api.MsdhVERSION_BUILD

version.loaded_with = mstorque_api.dhCoreVersion_ASSEMBLY_STR_Get()

return version

def run_code():

import pprint
print "______MS3D Information______"

print "MS3D Version:\t %s (%s)" % (mssys.VERSION, ms3d_config())

print

print "______MSGRAIL Information_____"

print "MSGRAIL Version:\t %s" % (info.VERSION_FULL_STR)

print "MSGRAIL Path:\t %s" % (info.GRAIL_DIR)

print "MSGRAIL Compiler:\t %s" % (info.COMPILER_INFO)

print "MSGRAIL 64 Bit:\t %s" % (libconfig.is_64bit)

print "MSGRAIL Built On:\t %s" % (info.VERSION_BUILD_DATE)

print

print "______Python MSTORQUE Information_____"

print "MSTORQUE: loading grail.data.mstorque api ...",

try:

from grail.data import mstorque

print "OK."

print "MSTORQUE Found:\t %s" % (mstorque.__file__)

# NOTE: That in torque v3.20 and earlier a mis-configured system

# will throw an uncaught exception that would cause MS3D to fail.

print "Locating MSTORQUE Version Used...",

version = make_torque_version(mstorque)

print "OK."

print "MSTORQUE Built With Version:\t %s" % (version.built_with)

print "MSTORQUE Actual Loaded Version:\t %s" % (version.loaded_with)

print "MSTORQUE Built On:\t %s" % (mstorque.dhCoreVersion_BUILD_DATE_Get())

except ImportError, e:

print "FAILED (%s)." % (str(e))

print
print "______MPYTHON Information_____"

try:

import mpython_info

# This is a system module, so it doesn't get reloaded each time

# we run em-info. To make sure it gets the very latest system

# stats, I invoke an explicit reload.

reload(mpython_info)

print "MPYTHON VERSION:\t %s" % (mpython_info.__version__)

except ImportError:

print "MPYTHON: Unable to load 'mpython_info'"

print

print "______wxPython Information________"

try:

import wx

print "WXPYTHON VERSION:\t %s" % (wx.__version__)

print "WXPYTHON LOCATION:\t %s" % (wx.__file__)

except ImportError, e:

print "Unable to import wxPython (wx): '%s'" % (str(e))

print

print "____Environment Information____"

print "COMSPEC Variable:\t '%s'" % (os.environ["COMSPEC"])

print

print "______Python Information________"

print "System Version:\t %s" % (sys.version)

print "System Executable:\t %s" % (sys.executable)


print "System Directory:\t %s" % (sys.prefix)

print "System Platform:\t %s" % (sys.platform)

print "Current Directory Search Order:"

ppindent = pprint.PrettyPrinter(indent=5)

ppindent.pprint(sys.path)

gmain = gsys.GMAIN(run_code, __name__)

gmain.run()

You might also like