mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Tweak some build stuff for versioning
This commit is contained in:
1 parent
0b1f3b51e3
commit
42c5b9534a
3 files changed
+46
-7
No files matched your search
@@ -2,6 +2,7 @@
|
||||
/minecraft_server
|
||||
/mods
|
||||
/fmlbuild.properties
|
||||
/fmlversion.properties
|
||||
/difflist.txt
|
||||
/.metadata/
|
||||
/eclipse/.metadata/
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#Thu, 10 May 2012 09:42:10 -0400
|
||||
|
||||
fmlbuild.major.number=2
|
||||
fmlbuild.minor.number=0
|
||||
fmlbuild.revision.number=0
|
||||
fmlbuild.build.number=1
|
||||
fmlbuild.mcversion=1.2.5
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
import os
|
||||
import commands
|
||||
import fnmatch
|
||||
import re
|
||||
import subprocess, shlex
|
||||
|
||||
def cmdsplit(args):
|
||||
if os.sep == '\\':
|
||||
args = args.replace('\\', '\\\\')
|
||||
return shlex.split(args)
|
||||
|
||||
def cleanDirs(path):
|
||||
if not os.path.isdir(path):
|
||||
return
|
||||
|
||||
files = os.listdir(path)
|
||||
if len(files):
|
||||
for f in files:
|
||||
fullpath = os.path.join(path, f)
|
||||
if os.path.isdir(fullpath):
|
||||
cleanDirs(fullpath)
|
||||
|
||||
files = os.listdir(path)
|
||||
if len(files) == 0:
|
||||
os.rmdir(path)
|
||||
|
||||
def main():
|
||||
print("Obtaining version information from git")
|
||||
cmd = "git describe --long"
|
||||
try:
|
||||
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
|
||||
vers, _ = process.communicate()
|
||||
except OSError:
|
||||
print("Git not found")
|
||||
vers="v1.0-0-deadbeef"
|
||||
(major,minor,rev,githash)=re.match("v(\d+).(\d+)-(\d+)-(.*)",vers).groups()
|
||||
with open("fmlversion.properties","w") as f:
|
||||
f.write("%s=%s\n" %("fmlbuild.major.number",major))
|
||||
f.write("%s=%s\n" %("fmlbuild.minor.number",minor))
|
||||
f.write("%s=%s\n" %("fmlbuild.revision.number",rev))
|
||||
f.write("%s=%s\n" %("fmlbuild.githash",githash))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user