Example #1
0
File: gist.py Project: Malex/pyg
 def install(self):
     with TempDir() as tempdir:
         acc = set()
         self.gist.download(tempdir, acc)
         if 'setup.py' not in self.gist.files:
             logger.fatal('Error: gist must contain at least the `setup.py` file')
         Installer.from_dir(tempdir, 'gist {0}'.format(self.gist.gist_id))
Example #2
0
File: _opts.py Project: fdev31/pyg
def install_func(packname, req_file, editable, ignore, yes):
    check_and_exit()
    if editable:
        if len(packname) > 1:
            logger.error('Error: Unable to install multiple packages in editable mode')
            return
        package = packname[0]
        if os.path.exists(os.path.abspath(package)):
            package = 'dir+{0}#egg={1}'.format(os.path.abspath(package),
                                               os.path.basename(package))
        return vcs(package).develop()
    if req_file:
        logger.info('Installing from requirements file')
        for rq in req_file:
            Installer.from_req_file(os.path.abspath(rq))
        return
    if packname:
        for package in packname:
            _install_package_from_name(package, ignore)
Example #3
0
File: _opts.py Project: fdev31/pyg
def _install_package_from_name(package, ignore=False):
    if os.path.exists(package) and not ignore:
        path = os.path.abspath(package)
        logger.info('Installing {0}', path)
        if os.path.isfile(path):
            return Installer.from_file(path)
        elif os.path.isdir(path):
            if not os.path.exists(os.path.join(path, 'setup.py')):
                raise PygError('{0} must contain the setup.py file', path)
            return Installer.from_dir(path)
        else:
            raise PygError('Cannot install the package: {0} is neither a file nor a directory', path)
    if package.startswith(('http://', 'https://')):
        return Installer.from_url(package)
    for s in ('git+', 'hg+', 'bzr+', 'svn+'):
        if package.startswith(s):
            with TempDir() as tempdir:
                return vcs(package, tempdir).install()
    return Installer(package).install()
Example #4
0
File: base.py Project: Malex/pyg
 def install(self):
     self.retrieve_data()
     Installer.from_dir(self.dir, self.package_name)