Пример #1
0
def _getTagLine():
    from fofix.core import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir('/gameroot/.git'):
        shortref = None
        headhash = None

        # HEAD is in the form "ref: refs/heads/master\n" if a branch is
        # checked out, or just the hash if HEAD is detached.
        refline = VFS.open('/gameroot/.git/HEAD').read().strip()

        if refline[0:5] == "ref: ":
            headref = refline[5:]
            if VFS.isfile('/gameroot/.git/' + headref):
                # The ref is in the form "sha1-hash\n"
                headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
            else:
                # It's a packed ref.
                for line in VFS.open('/gameroot/.git/packed-refs'):
                    if line.strip().endswith(headref):
                        headhash = line[:40]
                        break
            shortref = re.sub('^refs/(heads/)?', '', headref)
        else:
            shortref = "(detached)"
            headhash = refline

        return 'development (git %s %s)' % (shortref or "(unknown)",
                                            headhash and headhash[:7] or "(unknown)")
    else:
        return None
Пример #2
0
def _getTagLine():
    from fofix.core import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir('/gameroot/.git'):
        shortref = None
        headhash = None

        # HEAD is in the form "ref: refs/heads/master\n" if a branch is
        # checked out, or just the hash if HEAD is detached.
        refline = VFS.open('/gameroot/.git/HEAD').read().strip()

        if refline[0:5] == "ref: ":
            headref = refline[5:]
            if VFS.isfile('/gameroot/.git/' + headref):
                # The ref is in the form "sha1-hash\n"
                headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
            else:
                # It's a packed ref.
                for line in VFS.open('/gameroot/.git/packed-refs'):
                    if line.strip().endswith(headref):
                        headhash = line[:40]
                        break
            shortref = re.sub('^refs/(heads/)?', '', headref)
        else:
            shortref = "(detached)"
            headhash = refline

        return 'development (git %s %s)' % (shortref or "(unknown)", headhash
                                            and headhash[:7] or "(unknown)")
    else:
        return None
Пример #3
0
def savePlayers():
    for pref in _playerDB.execute('SELECT * FROM `players` WHERE `changed` = 1').fetchall():
        try:
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
        except:
            c = VFS.open(_makePlayerIniName(str(pref[0])), "w")
            c.close()
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
    _playerDB.execute('UPDATE `players` SET `loaded` = 0')
    _playerDB.commit()
Пример #4
0
def savePlayers():
    for pref in _playerDB.execute('SELECT * FROM `players` WHERE `changed` = 1').fetchall():
        try:
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
        except:
            c = VFS.open(_makePlayerIniName(str(pref[0])), "w")
            c.close()
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
    _playerDB.execute('UPDATE `players` SET `loaded` = 0')
    _playerDB.commit()
Пример #5
0
from fretwork import log

from fofix.core import Version
from fofix.core import VFS

# setup the logfile
# File object representing the logfile.
if os.name == "posix":  # evilynux - logfile in ~/.fofix/ for GNU/Linux and MacOS X
    # evilynux - Under MacOS X, put the logs in ~/Library/Logs
    if os.uname()[0] == "Darwin":
        logFile = open(
            os.path.expanduser('~/Library/Logs/%s.log' %
                               Version.PROGRAM_UNIXSTYLE_NAME), 'w')
    else:  # GNU/Linux et al.
        logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME,
                           'w')
else:
    logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME,
                       'w')

log.setLogfile(logFile)

import fretwork
fretworkRequired = (0, 2, 0)
reqVerStr = '.'.join([str(i) for i in fretworkRequired])
fretworkErrorStr = '''

The version of fretwork installed is old. Please install the latest version from github.
https://github.com/fofix/fretwork/releases/
Installed: {0}
Required: {1}
Пример #6
0
import fretwork

from fretwork import log

from fofix.core import Version
from fofix.core import VFS

# setup the logfile
# File object representing the logfile.
if os.name == "posix": # evilynux - logfile in ~/.fofix/ for GNU/Linux and MacOS X
    # evilynux - Under MacOS X, put the logs in ~/Library/Logs
    if os.uname()[0] == "Darwin":
        logFile = open(os.path.expanduser('~/Library/Logs/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME), 'w')
    else: # GNU/Linux et al.
        logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME, 'w')
else:
    logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME, 'w')

log.setLogfile(logFile)

import fretwork
fretworkRequired = (0, 2, 0)
reqVerStr = '.'.join([str(i) for i in fretworkRequired])
fretworkErrorStr = '''

The version of fretwork installed is old. Please install the latest version from github.
https://github.com/fofix/fretwork/releases/
Installed: {0}
Required: {1}
'''