Skip to content

Commit

Permalink
Make.py - Remove unneeded CfgConvert
Browse files Browse the repository at this point in the history
CfgConvert was needed for old version of pboProject, new version don't
need anymore and can have problems with the extra files created
  • Loading branch information
PabstMirror committed Nov 14, 2015
1 parent dc84bc7 commit ee5ddfb
Showing 1 changed file with 2 additions and 46 deletions.
48 changes: 2 additions & 46 deletions tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def check_for_obsolete_pbos(addonspath, file):


def backup_config(module):
#PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up:
#backup original $PBOPREFIX$.TXT
global work_drive
global prefix

Expand All @@ -515,52 +515,11 @@ def backup_config(module):
except:
print_error("Error creating backup of $PBOPREFIX$.TXT for module {}.".format(module))

try:
shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup"))
os.chdir(work_drive)
except:
print_error("Error creating backup of config.cpp for module {}.".format(module))

return True

def convert_config(module):
try:
global work_drive
global prefix
global arma3tools_path

cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")]
ret = subprocess.call(cmd)
if ret != 0:
print_error("CfgConvert -bin return code == {}. Usually means there is a syntax error within the config.cpp file.".format(str(ret)))
os.remove(os.path.join(work_drive, prefix, module, "config.cpp"))
shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp"))

cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")]
ret = subprocess.call(cmd)
if ret != 0:
print_error("CfgConvert -txt return code == {}. Usually means there is a syntax error within the config.cpp file.".format(str(ret)))
os.remove(os.path.join(work_drive, prefix, module, "config.cpp"))
shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp"))
except Exception as e:
print_error("Exception from convert_config=>CfgConvert: {}".format(e))
return False

return True


def addon_restore(modulePath):
#PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp
#print_green("\Pabst! (restoring): {}".format(os.path.join(modulePath, "config.cpp")))
#restore original $PBOPREFIX$.TXT
try:
if os.path.isfile(os.path.join(modulePath, "config.cpp")):
os.remove(os.path.join(modulePath, "config.cpp"))
if os.path.isfile(os.path.join(modulePath, "config.backup")):
os.rename(os.path.join(modulePath, "config.backup"), os.path.join(modulePath, "config.cpp"))
if os.path.isfile(os.path.join(modulePath, "config.bin")):
os.remove(os.path.join(modulePath, "config.bin"))
if os.path.isfile(os.path.join(modulePath, "texHeaders.bin")):
os.remove(os.path.join(modulePath, "texHeaders.bin"))
if os.path.isfile(os.path.join(modulePath, "$PBOPREFIX$.backup")):
if os.path.isfile(os.path.join(modulePath, "$PBOPREFIX$.TXT")):
os.remove(os.path.join(modulePath, "$PBOPREFIX$.TXT"))
Expand Down Expand Up @@ -1226,9 +1185,6 @@ def main(argv):
nobinFilePath = os.path.join(work_drive, prefix, module, "$NOBIN$")
backup_config(module)

if (not os.path.isfile(nobinFilePath)):
convert_config(module)

version_stamp_pboprefix(module,commit_id)

if os.path.isfile(nobinFilePath):
Expand Down

0 comments on commit ee5ddfb

Please sign in to comment.