Python tensorflow.__file__() Examples
The following are 22
code examples of tensorflow.__file__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow
, or try the search function
.
Example #1
Source File: tf.py From deep500 with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _custom_cpp_op(op: CompilableOp, stateful, name): """ Compiles and registers a custom C++ Tensorflow operator """ # Compile the .so file tf_path = os.path.abspath(os.path.dirname(tf.__file__)) so_file = TFCompiler().compile_op(op.name, op.files, op.inputs, op.outputs, any([f.endswith('.cu') for f in op.files]), op.live_output, additional_cmake_options=['-DTENSORFLOW_PATH=' + tf_path] + op.cmake_options, additional_definitions=op.defs, output_folder=op.output_folder) # Load the compiled library into Tensorflow op_module = tf.load_op_library(so_file) op_func = getattr(op_module, 'tf_op' + op.name) op_grad_func = getattr(op_module, 'tf_op_grad' + op.name) # Create the deep500 custom op object lib = ctypes.CDLL(so_file) if not getattr(lib, 'create_new_op', False): raise ValueError('Invalid custom operator library file') lib.create_new_op.restype = ctypes.c_int64 lib.is_cuda_supported.restype = ctypes.c_bool lib.report.restype = ctypes.c_int64 return TFCompiledOp(op, op_func, op_grad_func, lib)
Example #2
Source File: sysconfig.py From keras-lambda with MIT License | 5 votes |
def get_lib(): """Get the directory containing the TensorFlow framework library. Returns: The directory as string. """ import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'core')
Example #3
Source File: sysconfig.py From keras-lambda with MIT License | 5 votes |
def get_include(): """Get the directory containing the TensorFlow C++ header files. Returns: The directory as string. """ # Import inside the function. # sysconfig is imported from the tensorflow module, so having this # import at the top would cause a circular import, resulting in # the tensorflow module missing symbols that come after sysconfig. import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'include')
Example #4
Source File: sysconfig.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def get_lib(): """Get the directory containing the TensorFlow framework library. Returns: The directory as string. """ import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__))
Example #5
Source File: sysconfig.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def get_include(): """Get the directory containing the TensorFlow C++ header files. Returns: The directory as string. """ # Import inside the function. # sysconfig is imported from the tensorflow module, so having this # import at the top would cause a circular import, resulting in # the tensorflow module missing symbols that come after sysconfig. import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'include')
Example #6
Source File: tf.py From deep500 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def compile_op(self, name: str, files: List[str], input_tensors: List[TensorDescriptor], output_tensors: List[TensorDescriptor], is_cuda: bool, live_output: bool, additional_cmake_options: List[str], additional_definitions: Dict[str, str], output_folder: str): cmakelists_path = os.path.dirname(os.path.abspath(__file__)) # Create output folder dirname = os.path.join(output_folder, '%s_%s_build' % (name, 'tf')) # CUDA-specific macro defs = {} defs.update(additional_definitions) if is_cuda: defs.update({'__D500_OPHASCUDA': 1}) print('iscuda', is_cuda) # Create wrapper template wrapper_files = self.create_wrapper(name, dirname, input_tensors, output_tensors, is_cuda, files) # Compile dynamic library (and ignore main file, which is part of the wrapper) return cmake(name, files[1:] + wrapper_files, cmakelists_path, dirname, live_output=live_output, additional_cmake_options=additional_cmake_options, additional_definitions=defs)
Example #7
Source File: tf.py From deep500 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def create_wrapper(self, opname: str, dirname: str, input_tensors: List[TensorDescriptor], output_tensors: List[TensorDescriptor], is_cuda: bool, files: List[str]): curpath = os.path.abspath(os.path.dirname(__file__)) ext = ('.cpp' if not is_cuda else '.cu') # Read wrapper template template_file = os.path.join(curpath, 'tf.tmpl.cpp') with open(template_file, 'r') as f: tmpl = Template(f.read()) # Render template with tensor types pfile = tmpl.render(input_tensors=_ctup(input_tensors, 'inp'), output_tensors=_ctup(output_tensors, 'out'), output_shapes=[s.shape for s in output_tensors], nextop_grads=_ctup(output_tensors, 'nxtgrad'), input_grads=_ctup(input_tensors, 'inpgrad'), input_shapes=[s.shape for s in input_tensors], platforms=([('DEVICE_CPU', ''), ('DEVICE_GPU', 'Cuda')] if is_cuda else [('DEVICE_CPU', '')]), opfile='"' + os.path.abspath(files[0]) + '"', opname=opname) # Try to create a directory for the wrapper file try: os.makedirs(dirname) except (OSError, FileExistsError): pass wrapper_filename = os.path.join(dirname, 'tf' + ext) with open(wrapper_filename, 'w') as fp: fp.write(pfile) return [os.path.abspath(wrapper_filename)]
Example #8
Source File: sysconfig.py From deep_image_model with Apache License 2.0 | 5 votes |
def get_lib(): """Get the directory containing the TensorFlow framework library. Returns: The directory as string. """ import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'core')
Example #9
Source File: sysconfig.py From deep_image_model with Apache License 2.0 | 5 votes |
def get_include(): """Get the directory containing the TensorFlow C++ header files. Returns: The directory as string. """ # Import inside the function. # sysconfig is imported from the tensorflow module, so having this # import at the top would cause a circular import, resulting in # the tensorflow module missing symbols that come after sysconfig. import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'include')
Example #10
Source File: sysconfig.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def get_lib(): """Get the directory containing the TensorFlow framework library. Returns: The directory as string. """ import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'core')
Example #11
Source File: sysconfig.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def get_include(): """Get the directory containing the TensorFlow C++ header files. Returns: The directory as string. """ # Import inside the function. # sysconfig is imported from the tensorflow module, so having this # import at the top would cause a circular import, resulting in # the tensorflow module missing symbols that come after sysconfig. import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'include')
Example #12
Source File: sysconfig.py From lambda-packs with MIT License | 5 votes |
def get_lib(): """Get the directory containing the TensorFlow framework library. Returns: The directory as string. """ import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'core')
Example #13
Source File: sysconfig.py From lambda-packs with MIT License | 5 votes |
def get_include(): """Get the directory containing the TensorFlow C++ header files. Returns: The directory as string. """ # Import inside the function. # sysconfig is imported from the tensorflow module, so having this # import at the top would cause a circular import, resulting in # the tensorflow module missing symbols that come after sysconfig. import tensorflow as tf return _os_path.join(_os_path.dirname(tf.__file__), 'include')
Example #14
Source File: build_pip_package.py From Gun-Detector with Apache License 2.0 | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #15
Source File: build_pip_package.py From yolo_v2 with Apache License 2.0 | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #16
Source File: build_pip_package.py From hands-detection with MIT License | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #17
Source File: build_pip_package.py From object_detection_kitti with Apache License 2.0 | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #18
Source File: build_pip_package.py From object_detection_with_tensorflow with MIT License | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #19
Source File: build_pip_package.py From HumanRecognition with MIT License | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", "--no-preserve=all", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", "--no-preserve=all", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #20
Source File: build_pip_package.py From g-tensorflow-models with Apache License 2.0 | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #21
Source File: build_pip_package.py From multilabel-image-classification-tensorflow with MIT License | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))
Example #22
Source File: build_pip_package.py From DOTA_models with Apache License 2.0 | 4 votes |
def main(): cmd_args = argparse.ArgumentParser() cmd_args.add_argument("--include-tensorflow", action="store_true") cmd_args.add_argument("--output-dir", required=True) args = cmd_args.parse_args() if not os.path.isdir(args.output_dir): raise EnvironmentError( "Output directory {} doesn't exist".format(args.output_dir)) elif not args.output_dir.startswith("/"): raise EnvironmentError("Please pass an absolute path to --output-dir.") tmp_packaging = tempfile.mkdtemp() runfiles, = (path for path in sys.path if path.endswith("build_pip_package.runfiles")) # Use the dragnn and tensorflow modules to resolve specific paths in the # runfiles directory. Current Bazel puts dragnn in a __main__ subdirectory, # for example. lib_path = os.path.abspath(dragnn.__file__) if runfiles not in lib_path: raise EnvironmentError("WARNING: Unexpected PYTHONPATH set by Bazel :(") base_dir = os.path.dirname(os.path.dirname(lib_path)) tensorflow_dir = os.path.dirname(tensorflow.__file__) if runfiles not in tensorflow_dir: raise EnvironmentError("WARNING: Unexpected tf PYTHONPATH set by Bazel :(") # Copy the files. subprocess.check_call([ "cp", "-r", os.path.join(base_dir, "dragnn"), os.path.join( base_dir, "syntaxnet"), tmp_packaging ]) if args.include_tensorflow: subprocess.check_call( ["cp", "-r", tensorflow_dir, tmp_packaging]) shutil.copy( os.path.join(base_dir, "dragnn/tools/oss_setup.py"), os.path.join(tmp_packaging, "setup.py")) subprocess.check_output( ["python", "setup.py", "bdist_wheel"], cwd=tmp_packaging) wheel, = glob.glob("{}/*.whl".format(os.path.join(tmp_packaging, "dist"))) shutil.move(wheel, args.output_dir) print( "Wrote {}".format(os.path.join(args.output_dir, os.path.basename(wheel))))