FreeCAD
1#! python
2# -*- coding: utf-8 -*-
3# (c) 2012 Juergen Riegel LGPL
4#
5# Script to create files used in Windows build
6# uses SubWCRev.py for version detection#
7
8import SubWCRev, getopt, sys, string9
10
11def main():12
13input = ""14output = "."15
16try:17opts, args = getopt.getopt(sys.argv[1:], "dso:", ["dir=", "src=", "out="])18except getopt.GetoptError:19pass20
21for o, a in opts:22if o in ("-d", "--dir"):23print("The %s option is deprecated. Ignoring." % (o))24if o in ("-s", "--src"):25input = a26if o in ("-o", "--out"):27output = a28git = SubWCRev.GitControl()29
30if git.extractInfo(input, ""):31print(git.hash)32print(git.branch)33print(git.rev[0:4])34print(git.date)35print(git.url)36print(input)37print(output)38
39f = open(input, "r")40o = open(output, "w")41for line in f.readlines():42line = string.replace(line, "$WCREV$", git.rev[0:4])43line = string.replace(line, "$WCDATE$", git.date)44line = string.replace(line, "$WCURL$", git.url)45o.write(line)46
47
48if __name__ == "__main__":49main()50