コード例 #1
0
ファイル: binary_utils.py プロジェクト: billwei/commons
def profile_classpath(profile, java_runner=None, config=None, ivy_jar=None, ivy_settings=None):
  # TODO(John Sirois): consider rework when ant backend is gone and there is no more need to share
  # path structure

  def call_java(classpath, main, args):
    runjava(classpath=classpath, main=main, args=args)
  java_runner = java_runner or call_java

  config = config or Config.load()

  profile_dir = config.get('ivy-profiles', 'workdir')
  profile_libdir = os.path.join(profile_dir, '%s.libs' % profile)
  profile_check = '%s.checked' % profile_libdir
  if not os.path.exists(profile_check):
    # TODO(John Sirois): refactor IvyResolve to share ivy invocation command line bits
    ivy_classpath = [ivy_jar] if ivy_jar else config.getlist('ivy', 'classpath')

    safe_mkdir(profile_libdir)
    ivy_settings = ivy_settings or config.get('ivy', 'ivy_settings')
    ivy_xml = os.path.join(profile_dir, '%s.ivy.xml' % profile)
    ivy_args = [
      '-settings', ivy_settings,
      '-ivy', ivy_xml,

      # TODO(John Sirois): this pattern omits an [organisation]- prefix to satisfy IDEA jar naming
      # needs for scala - isolate this hack to idea.py where it belongs
      '-retrieve', '%s/[artifact]-[revision](-[classifier]).[ext]' % profile_libdir,

      '-sync',
      '-symlink',
      '-types', 'jar',
      '-confs', 'default'
    ]
    java_runner(classpath=ivy_classpath, main='org.apache.ivy.Main', args=ivy_args)
    with open(profile_check, 'w'): pass # touch

  return [os.path.join(profile_libdir, jar) for jar in os.listdir(profile_libdir)]
コード例 #2
0
ファイル: test_context.py プロジェクト: billwei/commons
 def setUpClass(cls):
   cls.config = Config.load()