view pyver.py @ 213:8b7bb1d72c1c beta

Traipse Beta 'OpenRPG' {100428-01} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Patch-2) New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up Daily-01: I somehow did not update the version number. Last changed file list: Currently selected branch: beta Author: sirebral Files Modified (in update): orpg/chat/chatwnd.py orpg/chat/commands.py orpg/dieroller/HOWTO.txt orpg/dieroller/base.py orpg/dieroller/dieroller.txt orpg/dieroller/rollers/std.py orpg/gametree/gametree.py orpg/gametree/nodehandlers/chatmacro.py orpg/gametree/nodehandlers/containers.py orpg/gametree/nodehandlers/forms.py orpg/gametree/nodehandlers/rpg_grid.py orpg/main.py orpg/map/__init__.py orpg/map/_background.py orpg/map/_canvas.py orpg/map/_circles.py orpg/map/_fog.py orpg/map/_grid.py orpg/map/_lines.py orpg/map/_minis.py orpg/map/_object.py orpg/map/_text.py orpg/map/_tiles.py orpg/mapper/background.py orpg/mapper/map.py orpg/mapper/whiteboard_handler.py orpg/networking/meta_server_lib.py orpg/networking/mplay_server.py orpg/networking/mplay_server_gui.py orpg/orpg_version.py orpg/templates/default_ignorelist.txt orpg/templates/default_settings.xml orpg/templates/metaservers.cache orpg/templates/nodes/split.xml orpg/templates/nodes/textctrl.xml orpg/tools/InterParse.py orpg/tools/aliaslib.py orpg/tools/orpg_log.py orpg/tools/orpg_settings.py plugins/xxurl2link.py readme.txt rollback.py start_developer.py start_noupdate.py start_tester.py upmana/ignorelist.txt upmana/updatemana.py
author sirebral
date Wed, 28 Apr 2010 08:13:35 -0500
parents 4385a7d0efd1
children
line wrap: on
line source

import sys  # Needed for version
import string # Needed for split
from orpg.orpg_version import * # To get NEEDS_PYTHON_MAJOR, MINOR, and MICRO

def getNumber(numberstringtoconvert):
    currentnumberstring = ""
    for number in numberstringtoconvert:
        if number >= "0" and number <="9":
            currentnumberstring += number
        else:
            break
    if currentnumberstring == "":
        return 0
    else:
        return int(currentnumberstring)
# This checks to make sure a certain version of python or later is in use
# The actual version requested is set in orpg/openrpg_version
def checkPyVersion():

    #  taking the first split on whitespace of sys.version gives us the version info without the build stuff
    vernumstring = string.split(sys.version)[0]

    #  This splits the version string into (major,minor,micro).  Actually, a complicating factor
    #  is that there sometimes isn't a micro, e.g. 2.0.  We'll just do it the hard way to build
    #  the numbers instead of tuple unpacking.
    splits = string.split(vernumstring,'.')

    #  Assign default values
    micro = 0
    minor = 0
    major = 0
    # Assign the integer conversion of each, assuming that it was found.  If not found, we assumed 0 just above.
    if len(splits) > 0:
        major = getNumber(splits[0])
    if len(splits) > 1:
        minor = getNumber(splits[1])
    if len(splits) > 2:
        micro = getNumber(splits[2])
    # Check against min version info from orpg/orpg_version
    if major >= NEEDS_PYTHON_MAJOR:
        if major > NEEDS_PYTHON_MAJOR:  # If it's greater, there's no need to check the minor
            return
        if minor >= NEEDS_PYTHON_MINOR:
            if minor > NEEDS_PYTHON_MINOR:  # If it's greater, there's no need to check the micro
                return
            if micro >= NEEDS_PYTHON_MICRO:
                return

    # If we get here, then the version check failed so we inform the user of the required version and exit
    print "Invalid python version being used.  Detected version %s,"  % (vernumstring)
    print "but version %i.%i.%i or better is required!" % (NEEDS_PYTHON_MAJOR,NEEDS_PYTHON_MINOR,NEEDS_PYTHON_MICRO)
    print "You either have the wrong version of Python installed or you"
    print "have multiple versions installed.  If you have multiple versions,"
    print "please make sure Python %i.%i.%i or better is found first in your path or explicitly" % (NEEDS_PYTHON_MAJOR,NEEDS_PYTHON_MINOR,NEEDS_PYTHON_MICRO)
    print "start using, \"<path>\python <program>\"."
    sys.exit( 1 )