コード例 #1
0
 def java_home_exe(self):
     with distribution(
             executables=EXE("bin/java", version="1")) as jdk1_home:
         with distribution(
                 executables=EXE("bin/java", version="2")) as jdk2_home:
             with temporary_file(binary_mode=False) as osx_java_home_exe:
                 osx_java_home_exe.write(
                     textwrap.dedent("""
                         #!/bin/sh
                         echo '<?xml version="1.0" encoding="UTF-8"?>
                         <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
                                                "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                         <plist version="1.0">
                         <array>
                           <dict>
                             <key>JVMHomePath</key>
                             <string>{jdk1_home}</string>
                           </dict>
                           <dict>
                             <key>JVMHomePath</key>
                             <string>{jdk2_home}</string>
                           </dict>
                         </array>
                         </plist>
                         '
                         """.format(jdk1_home=jdk1_home,
                                    jdk2_home=jdk2_home)).strip())
                 osx_java_home_exe.close()
                 chmod_plus_x(osx_java_home_exe.name)
                 locator = _Locator(
                     _UnknownEnvironment(
                         _EnvVarEnvironment(),
                         _OSXEnvironment(osx_java_home_exe.name)))
                 yield locator, jdk1_home, jdk2_home
コード例 #2
0
 def java_home_exe(self):
   with distribution(executables=EXE('bin/java', version='1')) as jdk1_home:
     with distribution(executables=EXE('bin/java', version='2')) as jdk2_home:
       with temporary_file() as osx_java_home_exe:
         osx_java_home_exe.write(textwrap.dedent("""
               #!/bin/sh
               echo '<?xml version="1.0" encoding="UTF-8"?>
               <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
                                      "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
               <plist version="1.0">
               <array>
                 <dict>
                   <key>JVMHomePath</key>
                   <string>{jdk1_home}</string>
                 </dict>
                 <dict>
                   <key>JVMHomePath</key>
                   <string>{jdk2_home}</string>
                 </dict>
               </array>
               </plist>
               '
             """.format(jdk1_home=jdk1_home, jdk2_home=jdk2_home)).strip())
         osx_java_home_exe.close()
         chmod_plus_x(osx_java_home_exe.name)
         locator = _Locator(_UnknownEnvironment(_EnvVarEnvironment(),
                                                _OSXEnvironment(osx_java_home_exe.name)))
         yield locator, jdk1_home, jdk2_home