release bundler to combine your includes into a single file

Started by jaymzjulian, February 28, 2020, 02:59:12 PM

Previous topic - Next topic

jaymzjulian

Just a simple release bundler - since it's easier to distribute one file than lots of files....  this is in my vx32tools repo at https://github.com/jaymzjulian/vectrex32_tools with the rest of my work tools.

I might have this later bundle binary files too - though currently I haven't worked out a good way to encode them without taking up all the ram/disk, so it might not happen!  But I'm less concerned with those - a .bas + a .ayc isn't too bad, whereas my current situation of like 8 files iwht generic names is not nearly as great ;).


import sys,shlex

def parsefile(f, outf):
  j=open(f).readlines()
  for line in j:
    if line.strip().startswith('include'):
      parsefile(shlex.split(line)[1], outf)
    else:
      outf.write(line)

if len(sys.argv)<2:
  print("Usage: vx32-bundle.py infile.bas outfile.bas")
outf=open(sys.argv[2], "wt")
parsefile(sys.argv[1], outf)