Skip to content

Commit

Permalink
Clarify the functions and documents
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed May 18, 2023
1 parent 2748dd1 commit e80a9e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 12 additions & 4 deletions python/tvm/contrib/cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""Util to invoke C/C++ compilers in the system."""
# pylint: disable=invalid-name
import sys
import shutil
import os
import subprocess

Expand Down Expand Up @@ -93,7 +94,10 @@ def _linux_ar(output, inputs, ar):
temp = _utils.tempdir()
temp_output = temp.relpath(libname)
cmd = [ar, "-crs", temp_output]
objects = _tar.untar_files(temp, inputs)

# handles the case where some input files are tar of objects
# unpack them and return the list of files inside
objects = _tar.normalize_file_list_by_unpacking_tars(temp, inputs)

cmd += objects
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
Expand All @@ -108,15 +112,19 @@ def _linux_ar(output, inputs, ar):


def create_staticlib(output, inputs, ar=None):
"""Create shared library.
"""Create static library.
Parameters
----------
output : str
The target shared library.
objects : List[str]
List of inputs files.
inputs : List[str]
List of inputs files. Each input file can be a tarball
of objects or an object file.
ar : Optional[str]
Path to the ar command to be used
"""

if _is_linux_like():
Expand Down
7 changes: 4 additions & 3 deletions python/tvm/contrib/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def untar(tar_file, directory):
raise RuntimeError(msg)


def untar_files(temp, file_list):
"""Untar all tars in the list to temp dirs and return untarred list.
def normalize_file_list_by_unpacking_tars(temp, file_list):
"""Normalize the file list by unpack tar files and return files in tar.
When a filename is a tar, it will untar it into an unique dir in temp.
When a filename is a tar, it will untar it into an unique dir
in temp and return the list of files in the tar.
When a filename is a normal file, it will be simply added to the list.
This is useful to untar objects in tar and then turn
Expand Down

0 comments on commit e80a9e0

Please sign in to comment.