コード例 #1
0
    def generate(self):
        """Generate patches from customized bdists.

        Limitations for now: one patchset per bdist, only apply to bdist with
        the same name.
        """
        for name, abspath in self.cmds.list("cloned").items():
            # create dir for bdist in patches if not exists
            patches_dir = self.cfg["patches_dir"]
            if not os.path.isabs(patches_dir):
                patches_dir = os.path.join(self.root, patches_dir)
            targetdir = os.path.join(patches_dir, name)
            if not os.path.isdir(patches_dir):
                os.mkdir(patches_dir)
            if not os.path.isdir(targetdir):
                os.mkdir(targetdir)
            # format-patch there
            if Popen(["git", "status", "--porcelain"], stdout=PIPE, cwd=abspath).communicate()[0]:
                logger.warn("Ignoring egg with uncommitted changes: %s." % (abspath,))
                continue
            tmp = Popen(["git", "branch", "--no-color"], cwd=abspath, stdout=PIPE).communicate()[0].split("\n")
            currentbranch = None
            for x in tmp:
                if x.startswith("*"):
                    currentbranch = x.split()[1]
                    break
            else:
                raise CouldNotDetectCurrentBranch
            if currentbranch == "__mrsd_patched__":
                logger.error("Ignoring egg on __mrsd_patched__ branch: %s." % (abspath,))
                return
            check_call(["git", "format-patch", "-o", targetdir, "initial..HEAD"], cwd=abspath)
コード例 #2
0
ファイル: develop.py プロジェクト: chaoflow/mrs.developer
    def __call__(self,
            egg_names=None,
            checkout=True,
            active=True,
            pargs=None,
            ):
        if pargs:
            egg_names = pargs.egg_name
            checkout = pargs.checkout
            active = pargs.active

        if not isinstance(egg_names, list):
            egg_names = [egg_names]

        eggs = dict()
        for name in egg_names:
            if os.path.sep in name:
                path = name
                name = name.split(os.path.sep, name)[-1]
            else:
                path = os.path.join(self.cfg['default_src_dir'], name)
            path = os.path.join(os.path.abspath(os.curdir), path)
            eggs[name] = path

        if checkout:
            Checkout('checkout', self)(egg_names)

        if active:
            for name, path in eggs.iteritems():
                # only activate existing eggs
                if not os.path.isdir(path):
                    logger.warn(
                            'Did not activate %s, path does not exist or '
                            'is not a directory %s.' % (name, path)
                            )
                    continue
                self.cfg['develop'][name] = path
                import pdb; pdb.set_trace()
                check_call([os.path.join('bin', 'buildout'), 'install', ])
        else:
            for name in eggs:
                self.cfg['develop'].pop(name, None)
        self.cmds.save_config()
コード例 #3
0
 def _iterchildkeys(self):
     """Our keys are the paths to distributions used by our script
     """
     consume = False
     for line in File(self.abspath):
         line = line.strip()
         if line.startswith("sys.path[0:0] = ["):
             consume = True
             continue
         elif line == "]":
             break
         elif not consume:
             continue
         # The key is the full path to the distribution
         key = line[1:-2]
         if not key.endswith(".egg"):
             logger.warn("Ignoring yet unsupported distribution in '%s'." % (key,))
             continue
         elif not os.path.isdir(key):
             logger.warn("Ignoring yet unsupported zipped bdist in '%s'." % (key,))
             continue
         yield key
コード例 #4
0
    def generate(self):
        """Generate patches from customized bdists.

        Limitations for now: one patchset per bdist, only apply to bdist with
        the same name.
        """
        for name, abspath in self.cmds.list('cloned').items():
            # create dir for bdist in patches if not exists
            patches_dir = self.cfg['patches_dir']
            if not os.path.isabs(patches_dir):
                patches_dir = os.path.join(self.root, patches_dir)
            targetdir = os.path.join(patches_dir, name)
            if not os.path.isdir(patches_dir):
                os.mkdir(patches_dir)
            if not os.path.isdir(targetdir):
                os.mkdir(targetdir)
            # format-patch there
            if Popen(['git', 'status', '--porcelain'],
                    stdout=PIPE, cwd=abspath).communicate()[0]:
                logger.warn('Ignoring egg with uncommitted changes: %s.' %
                        (abspath,))
                continue
            tmp = Popen(['git', 'branch', '--no-color'], cwd=abspath,
                    stdout=PIPE).communicate()[0].split('\n')
            currentbranch = None
            for x in tmp:
                if x.startswith('*'):
                    currentbranch = x.split()[1]
                    break
            else:
                raise CouldNotDetectCurrentBranch
            if currentbranch == '__mrsd_patched__': 
                logger.error('Ignoring egg on __mrsd_patched__ branch: %s.' %
                        (abspath,))
                return
            check_call(['git', 'format-patch', '-o', targetdir, 'initial..HEAD'], cwd=abspath)