FreeCAD

Форк
0
/
WinVersion.py 
49 строк · 1.2 Кб
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

8
import SubWCRev, getopt, sys, string
9

10

11
def main():
12

13
    input = ""
14
    output = "."
15

16
    try:
17
        opts, args = getopt.getopt(sys.argv[1:], "dso:", ["dir=", "src=", "out="])
18
    except getopt.GetoptError:
19
        pass
20

21
    for o, a in opts:
22
        if o in ("-d", "--dir"):
23
            print("The %s option is deprecated. Ignoring." % (o))
24
        if o in ("-s", "--src"):
25
            input = a
26
        if o in ("-o", "--out"):
27
            output = a
28
    git = SubWCRev.GitControl()
29

30
    if git.extractInfo(input, ""):
31
        print(git.hash)
32
        print(git.branch)
33
        print(git.rev[0:4])
34
        print(git.date)
35
        print(git.url)
36
        print(input)
37
        print(output)
38

39
        f = open(input, "r")
40
        o = open(output, "w")
41
        for line in f.readlines():
42
            line = string.replace(line, "$WCREV$", git.rev[0:4])
43
            line = string.replace(line, "$WCDATE$", git.date)
44
            line = string.replace(line, "$WCURL$", git.url)
45
            o.write(line)
46

47

48
if __name__ == "__main__":
49
    main()
50

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.