Exemplo n.º 1
0
  def test_longrunning_eclipse_generate(self):
    destination = 'eclipse-single'
    shutil.rmtree(os.path.join(_DATA_DIR, destination), ignore_errors=True)

    repositories, installUnits = Presets.combine_presets([TestPreset()])
    generator = EclipseGenerator(workingDir=_DATA_DIR, destination=destination, repositories=repositories,
      installUnits=installUnits, name='eclipse-test-single')
    generator.generate()
Exemplo n.º 2
0
 def test_eclipse_generate_noop(self):
     repositories, installUnits = Presets.combine_presets([TestPreset()])
     generator = EclipseGenerator(workingDir=_DATA_DIR,
                                  destination='noop',
                                  repositories=repositories,
                                  installUnits=[],
                                  name='eclipse-test-noop',
                                  fixIni=False)
     generator.generate()
Exemplo n.º 3
0
    def test_longrunning_eclipse_generate(self):
        destination = 'eclipse-single'
        shutil.rmtree(os.path.join(_DATA_DIR, destination), ignore_errors=True)

        repositories, installUnits = Presets.combine_presets([TestPreset()])
        generator = EclipseGenerator(workingDir=_DATA_DIR,
                                     destination=destination,
                                     repositories=repositories,
                                     installUnits=installUnits,
                                     name='eclipse-test-single')
        generator.generate()
Exemplo n.º 4
0
 def generate(self, **kwargs):
     generator = EclipseGenerator(self.workingDir,
                                  self.destination,
                                  repositories=self.repos,
                                  installUnits=self.ius,
                                  **kwargs)
     return generator.generate()
Exemplo n.º 5
0
 def test_eclipse_generate_noop(self):
   repositories, installUnits = Presets.combine_presets([TestPreset()])
   generator = EclipseGenerator(workingDir=_DATA_DIR, destination='noop', repositories=repositories,
     installUnits=[], name='eclipse-test-noop', fixIni=False)
   generator.generate()
Exemplo n.º 6
0
  def main(self, destination):
    if os.path.exists(destination):
      if os.path.isdir(destination) and os.listdir(destination):
        print('ERROR: destination {} is not empty'.format(destination))
        return 1
      print('ERROR: destination {} already exists'.format(destination))
      return 1

    presets = []
    for presetStr in self.presets:
      if not Presets.exists(presetStr):
        print('ERROR: preset {} does not exist'.format(presetStr))
        return 1
      presets.append(Presets[presetStr].value)

    oss = []
    if self.oss:
      for osStr in self.oss:
        if not Os.exists(osStr):
          print('ERROR: operating system {} does not exist'.format(osStr))
          return 1
        oss.append(Os[osStr].value)
    else:
      oss.append(Os.get_current())

    archs = []
    if self.archs:
      for archStr in self.archs:
        if not Arch.exists(archStr):
          print('ERROR: architecture {} does not exist'.format(archStr))
          return 1
        archs.append(Arch[archStr].value)
    else:
      archs.append(Arch.get_current())

    repositories, installUnits = Presets.combine_presets(presets)
    repositories.update(self.extraRepositories)
    installUnits.update(self.extraInstallUnits)

    if not repositories:
      print('ERROR: no presets or extra repositories were given')
      return 1
    if not installUnits:
      print('ERROR: no presets or extra units to install were given')
      return 1

    if len(oss) == 1 and len(archs) == 1:
      eclipseOs = oss[0]
      eclipseArch = archs[0]
      generator = EclipseGenerator(workingDir=os.getcwd(), destination=destination, os=eclipseOs, arch=eclipseArch,
        repositories=repositories, installUnits=installUnits, name=self.name, fixIni=self.fixIni, addJre=self.addJre,
        archive=self.archive, archiveJreSeparately=self.archiveJreSeparately, archivePrefix=self.archivePrefix,
        archiveSuffix=self.archiveSuffix)
      print('Generating Eclipse instance for {}, {} to path {}'.format(eclipseOs, eclipseArch, destination))
    else:
      generator = EclipseMultiGenerator(workingDir=os.getcwd(), destination=destination, oss=oss, archs=archs,
        repositories=repositories, installUnits=installUnits, name=self.name, fixIni=self.fixIni, addJre=self.addJre,
        archiveJreSeparately=self.archiveJreSeparately, archivePrefix=self.archivePrefix,
        archiveSuffix=self.archiveSuffix)
      print('Generating Eclipse instances for to path {}'.format(destination))
      print('Operating systems: {}'.format(', '.join([o.name for o in oss])))
      print('Architectures: {}'.format(', '.join([a.name for a in archs])))

    print('Repositories: ')
    for repository in repositories:
      print('  {}'.format(repository))
    print('Units to install: ')
    for installUnit in installUnits:
      print('  {}'.format(installUnit))
    print()

    generator.generate()

    return 0
Exemplo n.º 7
0
 def generate(self, **kwargs):
   generator = EclipseGenerator(self.workingDir, self.destination, repositories=self.repos, installUnits=self.ius,
     **kwargs)
   return generator.generate()