Commit 257cbfd2 by Baruch Sterin

add an option to the pyabc packaging scripts

parent e58713a6
ABC_PYTHON=/usr/bin/python
READLINE=0
CC := gcc CC := gcc
CXX := g++ CXX := g++
...@@ -40,7 +42,7 @@ arch_flags : arch_flags.c ...@@ -40,7 +42,7 @@ arch_flags : arch_flags.c
$(CC) arch_flags.c -o arch_flags $(CC) arch_flags.c -o arch_flags
ARCHFLAGS ?= $(shell $(CC) arch_flags.c -o arch_flags && ./arch_flags) ARCHFLAGS ?= $(shell $(CC) arch_flags.c -o arch_flags && ./arch_flags)
OPTFLAGS ?= -g -O #-DABC_NAMESPACE=xxx OPTFLAGS ?= -g -O3 #-DABC_NAMESPACE=xxx
MSG_PREFIX ?= MSG_PREFIX ?=
CFLAGS += -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare $(OPTFLAGS) $(ARCHFLAGS) -Isrc CFLAGS += -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare $(OPTFLAGS) $(ARCHFLAGS) -Isrc
......
...@@ -71,7 +71,7 @@ def add_file(tf, fname, arcname, mode, mtime): ...@@ -71,7 +71,7 @@ def add_file(tf, fname, arcname, mode, mtime):
with open(fname, "rb") as f: with open(fname, "rb") as f:
add_fileobj(tf, f, arcname, mode, mtime) add_fileobj(tf, f, arcname, mode, mtime)
def package(pyabc_dir, extra_bin, extra_lib, abc_exe, abc_sh, pyabc, ofname, scripts_dir, use_sys): def package(pyabc_dir, extra_bin, extra_lib, extra_files, abc_exe, abc_sh, pyabc, ofname, scripts_dir, use_sys):
mtime = time.time() mtime = time.time()
...@@ -106,6 +106,9 @@ def package(pyabc_dir, extra_bin, extra_lib, abc_exe, abc_sh, pyabc, ofname, scr ...@@ -106,6 +106,9 @@ def package(pyabc_dir, extra_bin, extra_lib, abc_exe, abc_sh, pyabc, ofname, scr
for lib in extra_lib: for lib in extra_lib:
add_python_lib( tf, lib_dir, lib, mtime) add_python_lib( tf, lib_dir, lib, mtime)
for file, dest in extra_files:
add_file(tf, file, '%s/%s'%(pyabc_dir, dest), 0666, mtime)
for entry in os.listdir(pyabc): for entry in os.listdir(pyabc):
if entry.endswith('.py'): if entry.endswith('.py'):
add_file( tf, os.path.join(pyabc, entry), os.path.join("%s/lib"%pyabc_dir, entry), 0666, mtime) add_file( tf, os.path.join(pyabc, entry), os.path.join("%s/lib"%pyabc_dir, entry), 0666, mtime)
...@@ -142,6 +145,7 @@ def main(args): ...@@ -142,6 +145,7 @@ def main(args):
parser.add_option("-d", "--pyabc_dir", dest="pyabc_dir", help="name of generated directory" ) parser.add_option("-d", "--pyabc_dir", dest="pyabc_dir", help="name of generated directory" )
parser.add_option("-b", "--extra_bin", dest="extra_bin", help="extra binaries to pack" ) parser.add_option("-b", "--extra_bin", dest="extra_bin", help="extra binaries to pack" )
parser.add_option("-l", "--extra_lib", dest="extra_lib", help="extra directories in lib to pack" ) parser.add_option("-l", "--extra_lib", dest="extra_lib", help="extra directories in lib to pack" )
parser.add_option("-f", "--extra_files", dest="extra_files", help="additional files (comma separated pairs of file:dest" )
parser.add_option("-a", "--abc", dest="abc", help="location of the ABC exeutable") parser.add_option("-a", "--abc", dest="abc", help="location of the ABC exeutable")
parser.add_option("-s", "--abc_sh", dest="abc_sh", help="location of the ABC setup script") parser.add_option("-s", "--abc_sh", dest="abc_sh", help="location of the ABC setup script")
parser.add_option("-p", "--pyabc", dest="pyabc", help="location of pyabc.py") parser.add_option("-p", "--pyabc", dest="pyabc", help="location of pyabc.py")
...@@ -161,8 +165,9 @@ def main(args): ...@@ -161,8 +165,9 @@ def main(args):
extra_bin = options.extra_bin.split(',') if options.extra_bin else [] extra_bin = options.extra_bin.split(',') if options.extra_bin else []
extra_lib = options.extra_lib.split(',') if options.extra_lib else [] extra_lib = options.extra_lib.split(',') if options.extra_lib else []
extra_files = [ s.split(':') for s in options.extra_files.split(',')] if options.extra_files else []
return package(options.pyabc_dir, extra_bin, extra_lib, options.abc, options.abc_sh, options.pyabc, options.out, options.scripts, options.sys) return package(options.pyabc_dir, extra_bin, extra_lib, extra_files, options.abc, options.abc_sh, options.pyabc, options.out, options.scripts, options.sys)
if __name__=="__main__": if __name__=="__main__":
main(sys.argv) main(sys.argv)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment