Ejemplo n.º 1
0
Archivo: inst.py Proyecto: Malex/pyg
 def _find_develop(self, dir, req):
     try:
         logger.info('Looking for a local package...')
         try:
             dist = Develop(req.name)
         except (ValueError, AttributeError):
             logger.error('Cannot find a local distribution for {0}', req.name, exc=PygError)
         else:
             # XXX: Add a `location` attribute in pkgtools' next release
             location = os.path.abspath(dist._arg_name)
             path = os.path.dirname(location)
             if not req.match(Version(dist.version)):
                 logger.error('Found {0}, but it does not match the requirement', path, exc=PygError)
             setup_py = os.path.join(path, 'setup.py')
             if not os.path.exists(setup_py):
                 logger.error('Cannot find setup.py for {0}', req.name, exc=PygError)
             logger.info('Found a matching package in {0}', path)
             with TempDir() as tempdir:
                 code, output = call_setup(path, ['sdist', '-d', tempdir])
                 if code != 0:
                     logger.fatal('setup.py failed to create the source distribution')
                     print_output(output, 'setup.py sdist')
                     raise PygError
                 arch = glob.glob(os.path.join(tempdir, '*{0}*'.format(req.name)))[0]
                 shutil.move(arch, dir)
                 arch_name = os.path.join(dir, os.path.basename(arch))
                 unpack(arch_name)
                 return arch_name
     except (PygError, IndexError, ValueError):
         return False
Ejemplo n.º 2
0
Archivo: vcs.py Proyecto: Malex/pyg
 def develop(self):
     logger.info('Running setup.py develop for {0}', self.package_name)
     code, output = call_setup(self.dest, ['develop'])
     if code != 0:
         logger.fatal('Error: setup.py develop did not install {0}', self.package_name)
         print_output(output, 'setup.py develop')
         raise InstallationError('setup.py did not install {0}'.format(self.package_name))
     logger.info('{0} installed succesfully', self.package_name)
Ejemplo n.º 3
0
Archivo: base.py Proyecto: Malex/pyg
 def develop(self):
     self.retrieve_data()
     if not os.path.exists(os.path.join(self.dir, 'setup.py')):
         logger.fatal('Error: The repository must have a top-level setup.py file', exc=InstallationError)
     logger.info('Running setup.py develop for {0}', self.package_name)
     code, output = call_setup(self.dir, ['develop'])
     if code != 0:
         logger.fatal('Error: setup.py develop did not install {0}', self.package_name)
         print_output(output, 'setup.py develop')
         raise InstallationError('setup.py did not install {0}'.format(self.package_name))
     logger.info('{0} installed succesfully', self.package_name)
Ejemplo n.º 4
0
Archivo: pack.py Proyecto: Malex/pyg
    def _gen_eggs(self, source_dir, egg_dir):
        r = re.compile(r'-py\d\.\d')
        def unzip_egg(arch_path):
            arch = os.path.basename(arch_path)
            eggname = arch[:r.search(arch).start()]
            with ZipFile(arch_path) as z:
                z.extractall(os.path.join(egg_dir, eggname))

        with TempDir() as tempdir:
            for dist in os.listdir(source_dir):
                code, output = call_setup(os.path.join(source_dir, dist), ['bdist_egg', '-d', tempdir])
                if code != 0:
                    logger.fatal('Error: cannot generate egg for {0}', dist)
                    print_output(output, 'setup.py bdist_egg')
                    raise PygError('cannot generate egg for {0}'.format(dist))
                arch = glob.glob(os.path.join(tempdir, dist) + '*.egg')[0]
                unzip_egg(arch)
Ejemplo n.º 5
0
Archivo: base.py Proyecto: Malex/pyg
 def retrieve_data(self):
     code, output = self.call_cmd([self.url])
     if code != 0:
         logger.fatal('Error: Cannot retrieve data')
         print_output(output, '{0} {1}'.format(self.cmd, self.method))
         logger.raise_last(InstallationError)