Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
Yorik van Havre 2012-02-05 15:28:54 -02:00
commit b2a068dcc7
8 changed files with 182 additions and 85 deletions

View File

@ -467,3 +467,9 @@ if(FREECAD_MAINTAINERS_BUILD AND NOT WIN32)
#ADD_CUSTOM_TARGET(DIST make package_source)
endif(FREECAD_MAINTAINERS_BUILD AND NOT WIN32)
add_custom_target(dist-git
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -1028,12 +1028,18 @@ void Application::initConfig(int argc, char ** argv)
// only for 'BuildVersionMajor'.
if (App::Application::Config().find("BuildVersionMajor") == App::Application::Config().end()) {
std::stringstream str; str << FCVersionMajor << "." << FCVersionMinor;
App::Application::Config()["ExeVersion"] = str.str();
App::Application::Config()["BuildVersionMajor"] = FCVersionMajor;
App::Application::Config()["BuildVersionMinor"] = FCVersionMinor;
App::Application::Config()["BuildRevision"] = FCRevision;
App::Application::Config()["BuildRepositoryURL"] = FCRepositoryURL;
App::Application::Config()["BuildRevisionDate"] = FCCurrentDateT;
App::Application::Config()["ExeVersion" ] = str.str();
App::Application::Config()["BuildVersionMajor" ] = FCVersionMajor;
App::Application::Config()["BuildVersionMinor" ] = FCVersionMinor;
App::Application::Config()["BuildRevision" ] = FCRevision;
App::Application::Config()["BuildRepositoryURL" ] = FCRepositoryURL;
App::Application::Config()["BuildRevisionDate" ] = FCRevisionDate;
#if defined(FCRepositoryHash)
App::Application::Config()["BuildRevisionHash" ] = FCRepositoryHash;
#endif
#if defined(FCRepositoryBranch)
App::Application::Config()["BuildRevisionBranch"] = FCRepositoryBranch;
#endif
}
_argc = argc;

View File

@ -1,18 +1,10 @@
/// Version Number
// Version Number
#define FCVersionMajor "0"
#define FCVersionMinor "13"
#define FCVersionName "Vulcan"
#define FCRevision "$WCREV$" //Highest committed revision number
#define FCRevisionDate "$WCDATE$" //Date of highest committed revision
#define FCRevisionRange "$WCRANGE$" //Update revision range
#define FCRepositoryURL "$WCURL$" //Repository URL of the working copy
#define FCCurrentDateT "$WCNOW$" //Current system date & time
//Placeholders of the form "$WCxxx?TrueText:FalseText$" are replaced with
//TrueText if the tested condition is true, and FalseText if false.
#define FCScrClean "$WCMODS?Src modified:Src not modified$" //True if local modifications found
#define FCScrMixed "$WCMIXED?Src mixed:Src not mixed$" //True if mixed update revisions found

View File

@ -16,13 +16,17 @@
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="labelSplashPicture">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer>
<property name="orientation">
@ -36,15 +40,18 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="labelSplashPicture">
<property name="text">
<string/>
<item row="2" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout">
@ -161,6 +168,34 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelBranch">
<property name="text">
<string notr="true">Branch</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="labelBuildBranch">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:7.8pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Unknown&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="labelBuildHash">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:7.8pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Unknown&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelHash">
<property name="text">
<string notr="true">Hash</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -178,19 +213,6 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer>
<property name="orientation">
@ -219,6 +241,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyButton">
<property name="text">
<string>Copy to clipboard</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
@ -239,19 +268,6 @@
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>181</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -264,7 +280,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="Icons/resource.qrc"/>
<include location="../../../FreeCAD/src/Gui/Icons/resource.qrc"/>
</resources>
<connections>
<connection>

View File

@ -248,18 +248,18 @@ static QString getPlatform()
void AboutDialog::setupLabels()
{
QString exeName = QString::fromAscii(App::Application::Config()["ExeName"].c_str());
std::map<std::string,std::string>& cfg = App::Application::Config();
std::map<std::string,std::string>::iterator it = cfg.find("WindowTitle");
if (it != cfg.end())
std::map<std::string, std::string>& config = App::Application::Config();
QString exeName = QString::fromAscii(config["ExeName"].c_str());
std::map<std::string,std::string>::iterator it = config.find("WindowTitle");
if (it != config.end())
exeName = QString::fromUtf8(it->second.c_str());
QString banner = QString::fromUtf8(App::Application::Config()["ConsoleBanner"].c_str());
QString banner = QString::fromUtf8(config["ConsoleBanner"].c_str());
banner = banner.left( banner.indexOf(QLatin1Char('\n')) );
QString major = QString::fromAscii(App::Application::Config()["BuildVersionMajor"].c_str());
QString minor = QString::fromAscii(App::Application::Config()["BuildVersionMinor"].c_str());
QString build = QString::fromAscii(App::Application::Config()["BuildRevision"].c_str());
QString disda = QString::fromAscii(App::Application::Config()["BuildRevisionDate"].c_str());
QString mturl = QString::fromAscii(App::Application::Config()["MaintainerUrl"].c_str());
QString major = QString::fromAscii(config["BuildVersionMajor"].c_str());
QString minor = QString::fromAscii(config["BuildVersionMinor"].c_str());
QString build = QString::fromAscii(config["BuildRevision"].c_str());
QString disda = QString::fromAscii(config["BuildRevisionDate"].c_str());
QString mturl = QString::fromAscii(config["MaintainerUrl"].c_str());
QString author = ui->labelAuthor->text();
author.replace(QString::fromAscii("Unknown Application"), exeName);
@ -283,10 +283,38 @@ void AboutDialog::setupLabels()
platform.replace(QString::fromAscii("Unknown"),
QString::fromAscii("%1 (%2-bit)").arg(getPlatform()).arg(QSysInfo::WordSize));
ui->labelBuildPlatform->setText(platform);
// branch name
it = config.find("BuildRevisionBranch");
if (it != config.end()) {
QString branch = ui->labelBuildBranch->text();
branch.replace(QString::fromAscii("Unknown"), QString::fromAscii(it->second.c_str()));
ui->labelBuildBranch->setText(branch);
}
else {
ui->labelBranch->hide();
ui->labelBuildBranch->hide();
}
// hash id
it = config.find("BuildRevisionHash");
if (it != config.end()) {
QString hash = ui->labelBuildHash->text();
hash.replace(QString::fromAscii("Unknown"), QString::fromAscii(it->second.c_str()));
ui->labelBuildHash->setText(hash);
}
else {
ui->labelHash->hide();
ui->labelBuildHash->hide();
}
}
void AboutDialog::on_licenseButton_clicked()
{
}
void AboutDialog::on_copyButton_clicked()
{
}
#include "moc_Splashscreen.cpp"

View File

@ -85,6 +85,7 @@ protected:
protected Q_SLOTS:
virtual void on_licenseButton_clicked();
virtual void on_copyButton_clicked();
private:
Ui_AboutApplication* ui;

View File

@ -50,11 +50,7 @@ class VersionControl:
def __init__(self):
self.rev = ""
self.date = ""
self.range = ""
self.url = ""
self.time = ""
self.mods = "Src not modified"
self.mixed = "Src not mixed"
def extractInfo(self, srcdir):
return False
@ -67,11 +63,7 @@ class VersionControl:
for line in lines:
line = string.replace(line,'$WCREV$',self.rev)
line = string.replace(line,'$WCDATE$',self.date)
line = string.replace(line,'$WCRANGE$',self.range)
line = string.replace(line,'$WCURL$',self.url)
line = string.replace(line,'$WCNOW$',self.time)
line = string.replace(line,'$WCMODS?Src modified:Src not modified$',self.mods)
line = string.replace(line,'$WCMIXED?Src mixed:Src not mixed$',self.mixed)
content.append(line)
return content
@ -82,9 +74,7 @@ class UnknownControl(VersionControl):
return False
self.rev = "Unknown"
self.date = "Unknown"
self.range = "Unknown"
self.url = "Unknown"
self.time = "Unknown"
return True
def printInfo(self):
@ -104,13 +94,10 @@ class DebianChangelog(VersionControl):
r=re.search("bzr(\\d+)",c)
if r != None:
self.rev = r.groups()[0] + " (Launchpad)"
self.range = self.rev
t = time.localtime()
self.url = "https://code.launchpad.net/~vcs-imports/freecad/trunk"
#self.time = time.asctime()
self.date = ("%d/%02d/%02d %02d:%02d:%02d") % (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)
self.time = ("%d/%02d/%02d %02d:%02d:%02d") % (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)
self.url = "https://code.launchpad.net/~vcs-imports/freecad/trunk"
return True
def printInfo(self):
@ -121,8 +108,6 @@ class BazaarControl(VersionControl):
info=os.popen("bzr log -l 1 %s" % (srcdir)).read()
if len(info) == 0:
return False
#Get the current local date
self.time = time.strftime("%Y/%m/%d %H:%M:%S")
lines=info.split("\n")
for i in lines:
r = re.match("^revno: (\\d+)$", i)
@ -151,7 +136,6 @@ class GitControl(VersionControl):
if len(info) == 0:
return False
self.rev='%04d (Git)' % (info.count('\n'))
self.range='%04d' % (info.count('\n'))
# date/time
info=os.popen("git log -1 --date=iso").read()
info=info.split("\n")
@ -159,9 +143,7 @@ class GitControl(VersionControl):
r = re.match("^Date:\\W+(\\d+-\\d+-\\d+\\W+\\d+:\\d+:\\d+)", i)
if r != None:
self.date = r.groups()[0].replace('-','/')
self.time = self.date
break
#self.time = time.strftime("%Y/%m/%d %H:%M:%S")
self.url = "Unknown"
info=os.popen("git remote -v").read()
info=info.split("\n")
@ -170,11 +152,20 @@ class GitControl(VersionControl):
if r != None:
self.url = r.groups()[0]
break
self.hash=os.popen("git log -1 --pretty=format:%H").read()
self.branch=os.popen("git branch").read().split('\n')[0][2:]
return True
def printInfo(self):
print "git"
def writeVersion(self, lines):
content = VersionControl.writeVersion(self, lines)
content.append('// Git relevant stuff\n')
content.append('#define FCRepositoryHash "%s"\n' % (self.hash))
content.append('#define FCRepositoryBranch "%s"\n' % (self.branch))
return content
class MercurialControl(VersionControl):
def extractInfo(self, srcdir):
return False

57
src/Tools/makedist.py Normal file
View File

@ -0,0 +1,57 @@
#! python
# -*- coding: utf-8 -*-
# (c) 2006 Werner Mayer LGPL
#
# Python script to make source tarballs.
#
import sys, os, getopt, tarfile, gzip, time, StringIO
def main():
srcdir="."
bindir="."
try:
opts, args = getopt.getopt(sys.argv[1:], "sb:", ["srcdir=","bindir="])
except getopt.GetoptError:
pass
for o, a in opts:
if o in ("-s", "--srcdir"):
srcdir = a
if o in ("-b", "--bindir"):
bindir = a
# revision number
info=os.popen("git rev-list HEAD").read()
revision='%04d' % (info.count('\n'))
PACKAGE_NAME = 'freecad'
version = "0.13.%s" % (revision)
DIRNAME = "%(p)s-%(v)s" % {'p': PACKAGE_NAME, 'v': version}
TARNAME = DIRNAME + '.tar.gz'
verfile = open("%s/src/Build/Version.h" % (bindir), 'r')
verstream = StringIO.StringIO(verfile.read())
verfile.close()
verinfo = tarfile.TarInfo(DIRNAME + "/src/Build/Version.h")
verinfo.mode = 0660
verinfo.size = len(verstream.getvalue())
verinfo.mtime = time.time()
print "git archive --worktree-attributes --prefix=%s/ HEAD" % (DIRNAME)
tardata = os.popen("git archive --worktree-attributes --prefix=%s/ HEAD"
% (DIRNAME)).read()
tarstream = StringIO.StringIO(tardata)
tar = tarfile.TarFile(mode="a", fileobj=tarstream)
tar.addfile(verinfo, verstream)
tar.close()
out = gzip.open(TARNAME, "wb")
out.write(tarstream.getvalue())
out.close()
print "Created " + TARNAME
if __name__ == "__main__":
main()