Skip to content

Commit

Permalink
Merge pull request #50 from blackwind/master
Browse files Browse the repository at this point in the history
Deprecate `eg.revision`, remove previously deprecated items
  • Loading branch information
blackwind committed Apr 9, 2016
2 parents 112252a + 62149a6 commit c0bffbe
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build/Build.py
Expand Up @@ -184,7 +184,7 @@ def CreateInstaller(self):
destName="pyw.exe"
)
inno.AddFile(
join(self.tmpDir, "VersionRevision.py"),
join(self.tmpDir, "VersionInfo.py"),
destDir="eg\\Classes"
)
# create entries in the [InstallDelete] section of the Inno script to
Expand Down
4 changes: 2 additions & 2 deletions build/builder/Gui.py
Expand Up @@ -22,7 +22,7 @@
import wx

import builder
from Utils import GetRevision, ParseVersion
from Utils import GetVersion, ParseVersion

class MainDialog(wx.Dialog):

Expand Down Expand Up @@ -191,7 +191,7 @@ def OnClose(self, event):


def RefreshVersion(self, event):
GetRevision(self.buildSetup)
GetVersion(self.buildSetup)
self.versionStr.SetValue(self.buildSetup.appVersion)


Expand Down
5 changes: 2 additions & 3 deletions build/builder/Tasks.py
Expand Up @@ -24,22 +24,21 @@

class UpdateVersionFile(builder.Task):
"""
Update buildTime and revision for eg/Classes/VersionRevision.py
Write version information to eg/Classes/VersionInfo.py
"""
description = "Update version file"
enabled = False

def DoTask(self):
buildSetup = self.buildSetup
buildSetup.buildTime = time.time()
filename = join(buildSetup.tmpDir, "VersionRevision.py")
filename = join(buildSetup.tmpDir, "VersionInfo.py")
outfile = open(filename, "wt")
major, minor, patch = buildSetup.appVersionShort.split('.')[:3]
outfile.write("string = '{0}'\n".format(buildSetup.appVersion))
outfile.write("major = {0}\n".format(major))
outfile.write("minor = {0}\n".format(minor))
outfile.write("patch = {0}\n".format(patch))
outfile.write("revision = {0}\n".format(buildSetup.appRevision))
outfile.write("buildTime = {0}\n".format(buildSetup.buildTime))
outfile.close()

Expand Down
9 changes: 3 additions & 6 deletions build/builder/Utils.py
Expand Up @@ -80,11 +80,11 @@ def ExecutePy(*args):
return StartProcess(sys.executable, "-u", "-c", "\n".join(args))


def GetRevision(buildSetup):
def GetVersion(buildSetup):
"""
Get the app version and revision.
Get the app version.
"""
#print "getting version and revision from GitHub."
#print "getting version from GitHub."
if buildSetup.gitConfig["token"] and buildSetup.args.version is None:
parts = GetLastReleaseOrTagName(buildSetup).split('.')[:3]
parts[0] = parts[0].strip('v')
Expand All @@ -93,9 +93,6 @@ def GetRevision(buildSetup):
parts[2] = int(parts[2]) + 1
buildSetup.appVersion = '{0}.{1}.{2}'.format(*parts)
buildSetup.appVersionShort = buildSetup.appVersion
magic = 1722 - 1046 # Last SVN revision - total Git commits at r1722
commits = GetCommitCount(buildSetup)
buildSetup.appRevision = (commits + magic) if commits else 0
else:
buildSetup.appVersion, buildSetup.appVersionShort = (
ParseVersion(buildSetup.args.version)
Expand Down
5 changes: 2 additions & 3 deletions build/builder/__init__.py
Expand Up @@ -25,7 +25,7 @@
import builder
from builder import VirtualEnv
from builder.Utils import (
DecodePath, GetRevision, GetGitHubConfig, ParseVersion,
DecodePath, GetVersion, GetGitHubConfig, ParseVersion,
)


Expand Down Expand Up @@ -106,7 +106,6 @@ def __init__(self):

self.appVersion = None
self.appVersionShort = None
self.appRevision = 0
self.tmpDir = tempfile.mkdtemp()
self.appName = self.name

Expand Down Expand Up @@ -156,7 +155,7 @@ def Start(self):
self.config = Config(self, join(self.dataDir, "Build.ini"))
for task in self.tasks:
task.Setup()
GetRevision(self)
GetVersion(self)
if self.showGui:
import Gui
Gui.Main(self)
Expand Down
4 changes: 2 additions & 2 deletions eg/Classes/Config.py
Expand Up @@ -81,7 +81,7 @@ def RecursivePySave(obj, fileWriter, indent=""):


class Config(Section):
revision = 0
version = eg.Version.string
if LOCALE.GetLanguageName(LOCALE.GetSystemLanguage()) == 'German':
language = 'de_DE'
else:
Expand Down Expand Up @@ -139,7 +139,7 @@ def __init__(self):


def Save(self):
self.revision = eg.revision
self.version = eg.Version.string
configFile = open(self._configFilePath, 'w+')
RecursivePySave(self, configFile.write)
configFile.close()
Expand Down
1 change: 0 additions & 1 deletion eg/Classes/Document.py
Expand Up @@ -28,7 +28,6 @@
class TreeStateData(eg.PersistentData):
guid = None
time = None
expandState = None # deprecated
expanded = None


Expand Down
1 change: 0 additions & 1 deletion eg/Classes/EventGhostEvent.py
Expand Up @@ -131,7 +131,6 @@ def Execute(self):

eg.event = self
eg.eventString = eventString
eg.EventString = eventString # eg.EventString is deprecated

eventHandlerList = []
for key, val in eg.eventTable.iteritems():
Expand Down
4 changes: 2 additions & 2 deletions eg/Classes/Log.py
Expand Up @@ -198,7 +198,7 @@ def PrintTraceback(self, msg=None, skip=0, source=None, excInfo=None):
if excInfo is None:
excInfo = sys.exc_info()
tbType, tbValue, tbTraceback = excInfo
slist = ['Traceback (most recent call last) (%d):\n' % eg.revision]
slist = ['Traceback (most recent call last) (%s):\n' % eg.Version.string]
if tbTraceback:
decode = codecs.getdecoder('mbcs')
for fname, lno, funcName, text in extract_tb(tbTraceback)[skip:]:
Expand All @@ -220,7 +220,7 @@ def PrintTraceback(self, msg=None, skip=0, source=None, excInfo=None):


def PrintStack(self, skip=0):
strs = ['Stack trace (most recent call last) (%d):\n' % eg.revision]
strs = ['Stack trace (most recent call last) (%s):\n' % eg.Version.string]
strs += format_stack(sys._getframe().f_back)[skip:]
error = "".join(strs)
self.Write(error.rstrip() + "\n", ERROR_ICON)
Expand Down
2 changes: 1 addition & 1 deletion eg/Classes/RootItem.py
Expand Up @@ -40,7 +40,7 @@ def GetData(self):
self.guid = str(GUID.create_new())
self.time = str(time.time())
attr = []
attr.append(('Version', str(eg.revision)))
attr.append(('Version', str(eg.Version.string)))
attr.append(('Guid', self.guid))
attr.append(('Time', self.time))
return attr, None
Expand Down
2 changes: 1 addition & 1 deletion eg/Classes/TreeItem.py
Expand Up @@ -152,7 +152,7 @@ def GetXmlString(self):
if isinstance(self, eg.RootItem):
self.WriteXmlString(stream.write)
else:
stream.write('<EventGhost Version="%s">\r\n' % str(eg.revision))
stream.write('<EventGhost Version="%s">\r\n' % str(eg.Version.string))
self.WriteXmlString(stream.write, " ")
stream.write('</EventGhost>')
xmlString = stream.getvalue()
Expand Down
6 changes: 2 additions & 4 deletions eg/Classes/Version.py
Expand Up @@ -18,11 +18,9 @@

class Version:
try:
from VersionRevision import (
string, major, minor, patch, revision, buildTime
)
from VersionInfo import string, major, minor, patch, buildTime
base = string
except ImportError:
base = string = "WIP"
major = minor = patch = revision = buildTime = 0
major = minor = patch = buildTime = 0

3 changes: 1 addition & 2 deletions eg/Core.py
Expand Up @@ -60,7 +60,7 @@
"lib%d%d" % sys.version_info[:2],
"site-packages"
)
eg.revision = eg.Version.revision
eg.revision = 2000 # Deprecated
eg.startupArguments = eg.Cli.args
eg.debugLevel = eg.startupArguments.debugLevel
eg.systemEncoding = locale.getdefaultlocale()[1]
Expand All @@ -72,7 +72,6 @@
eg.event = None
eg.eventTable = {}
eg.eventString = ""
eg.EventString = "" # eg.EventString is deprecated
eg.notificationHandlers = {}
eg.programCounter = None
eg.programReturnStack = []
Expand Down

0 comments on commit c0bffbe

Please sign in to comment.