<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __finalize_hdfs(self, ext):
 """\ Adds a few bits that depend on the specific environment. Delaying this until the build_ext phase allows non-build commands (e.g., sdist) to be run without java. """

        java_home = jvm.get_java_home()
        jvm_lib_path, _ = jvm.get_jvm_lib_path_and_name(java_home)
        ext.include_dirs = jvm.get_include_dirs() + ext.include_dirs
        ext.libraries = jvm.get_libraries()
        ext.library_dirs = [os.path.join(java_home, "Libraries"), jvm_lib_path]
        ext.define_macros = jvm.get_macros()
        ext.extra_link_args = ['-Wl,-rpath,%s' % jvm_lib_path]
        if self.__have_better_tls():
            ext.define_macros.append(("HAVE_BETTER_TLS", None))
        try:
            # too many warnings in libhdfs
            self.compiler.compiler_so.remove("-Wsign-compare")
        except (AttributeError, ValueError):
            pass