forked from Arelle/Arelle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildVersion.py
55 lines (48 loc) · 2.49 KB
/
buildVersion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'''
Created on May 28, 2011
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
This module emits the version.py file contents which are used in the
build process to indicate the time that this version was built.
'''
import datetime, sys
if __name__ == "__main__":
is64BitPython = sys.maxsize == 0x7fffffffffffffff
timestamp = datetime.datetime.utcnow()
versionPy = ("'''\n"
"This module represents the time stamp when Arelle was last built\n"
"\n"
"@author: Mark V Systems Limited\n"
"(c) Copyright {0} Mark V Systems Limited, All rights reserved.\n"
"\n"
"'''\n"
"version = '{1}'\n"
).format(timestamp.year,
timestamp.strftime("%Y-%m-%d %H:%M UTC")
)
with open("arelle/Version.py", "w") as fh:
fh.write(versionPy)
distFileDate = timestamp.strftime("%Y-%m-%d")
if sys.platform == "darwin":
with open("buildRenameDmg.sh", "w") as fh:
fh.write("mv dist_dmg/arelle.dmg dist_dmg/arelle-macOS-{}.dmg\n".format(distFileDate))
if sys.platform == "linux2":
with open("buildRenameLinux-x86_64.sh", "w") as fh:
fh.write("mv dist/exe.linux-x86_64-3.2.tar.gz dist/arelle-linux-x86_64-{}.tar.gz\n".format(distFileDate))
elif sys.platform == "linux": # python 3.3
with open("buildRenameLinux-x86_64.sh", "w") as fh:
fh.write("mv dist/exe.linux-x86_64-3.3.tar.gz dist/arelle-linux-x86_64-{}.tar.gz\n".format(distFileDate))
elif sys.platform == "sunos5":
with open("buildRenameSol10Sun4.sh", "w") as fh:
fh.write("mv dist/exe.solaris-2.10-sun4v{0}-{1}.tar.gz dist/arelle-solaris10-sun4{0}-{2}.tar.gz\n"
.format(".64bit" if is64BitPython else "",
sys.version[0:3],
distFileDate))
elif sys.platform.startswith("win"):
renameCmdFile = "buildRenamer.bat"
with open("buildRenameX86.bat", "w") as fh:
fh.write("rename dist\\arelle-win-x86.exe arelle-win-x86-{}.exe\n".format(distFileDate))
with open("buildRenameX64.bat", "w") as fh:
fh.write("rename dist\\arelle-win-x64.exe arelle-win-x64-{}.exe\n".format(distFileDate))
with open("buildRenameSvr27.bat", "w") as fh:
fh.write("rename dist\\arelle-svr-2.7.zip arelle-svr-2.7-{}.zip\n".format(distFileDate))