MCPcopy Index your code
hub / github.com/kivy/python-for-android / biglink_function

Function biglink_function

pythonforandroid/build.py:992–1038  ·  view source on GitHub ↗
(soname, objs_paths, extra_link_dirs=None, env=None)

Source from the content-addressed store, hash-verified

990
991
992def biglink_function(soname, objs_paths, extra_link_dirs=None, env=None):
993 if extra_link_dirs is None:
994 extra_link_dirs = []
995 print('objs_paths are', objs_paths)
996 sofiles = []
997
998 for directory in objs_paths:
999 for fn in os.listdir(directory):
1000 fn = os.path.join(directory, fn)
1001
1002 if not fn.endswith(".so.o"):
1003 continue
1004 if not os.path.exists(fn[:-2] + ".libs"):
1005 continue
1006
1007 sofiles.append(fn[:-2])
1008
1009 # The raw argument list.
1010 args = []
1011
1012 for fn in sofiles:
1013 afn = fn + ".o"
1014 libsfn = fn + ".libs"
1015
1016 args.append(afn)
1017 with open(libsfn) as fd:
1018 data = fd.read()
1019 args.extend(data.split(" "))
1020
1021 unique_args = []
1022 while args:
1023 a = args.pop()
1024 if a in ('-L', ):
1025 continue
1026 if a not in unique_args:
1027 unique_args.insert(0, a)
1028
1029 for dir in extra_link_dirs:
1030 link = '-L{}'.format(dir)
1031 if link not in unique_args:
1032 unique_args.append(link)
1033
1034 cc_name = env['CC']
1035 cc = sh.Command(cc_name.split()[0])
1036 cc = cc.bake(*cc_name.split()[1:])
1037
1038 shprint(cc, '-shared', '-O3', '-o', soname, *unique_args, _env=env)
1039
1040
1041def copylibs_function(soname, objs_paths, extra_link_dirs=None, env=None):

Callers

nothing calls this directly

Calls 2

shprintFunction · 0.90
formatMethod · 0.80

Tested by

no test coverage detected