Esempio n. 1
0
 def make(self):
     for ver, python in self._gen_pythons():
         if ver < (2, 3):
             # Don't support Python < 2.3.
             continue
         #elif ver >= (3, 0):
         #    # Don't yet support Python 3.
         #    continue
         ver_str = "%s.%s" % ver
         print "-- test with Python %s (%s)" % (ver_str, python)
         assert ' ' not in python
         sh.run("%s setup.py test" % python)
Esempio n. 2
0
 def make(self):
     for ver, python in self._gen_pythons():
         if ver < (2,3):
             # Don't support Python < 2.3.
             continue
         #elif ver >= (3, 0):
         #    # Don't yet support Python 3.
         #    continue
         ver_str = "%s.%s" % ver
         print "-- test with Python %s (%s)" % (ver_str, python)
         assert ' ' not in python
         sh.run("%s setup.py test" % python)
Esempio n. 3
0
    def make(self):
        # komododoc.manifest
        defines = {"LANG": self.cfg.lang}
        src = join("mozhelp", "chrome.manifest")
        dst = join(self.cfg.chrome_dir, "komododoc.manifest")
        sh.mkdir(dirname(dst), log=self.log)
        self.log.info("preprocess %s %s", src, dst)
        preprocess.preprocess(src,
                              dst,
                              defines,
                              contentType="Text",
                              substitute=True)

        # content
        content_dir = join(self.cfg.chrome_dir, "komododoc", "content")
        sh.mkdir(content_dir, log=self.log)
        sh.cp(join("mozhelp", "helpOverlay.xul"),
              dstdir=content_dir,
              log=self.log.info)

        # locale
        sh.mkdir(self.locale_dir, log=self.log)
        sh.cp(join("mozhelp", "help_help.xhtml"),
              dstdir=self.locale_dir,
              log=self.log.info)
        sh.cp(join("mozhelp", "komodohelp.rdf"),
              dstdir=self.locale_dir,
              log=self.log.info)
        sh.cp(join(self.htdocs_dir, "*"),
              dstdir=self.locale_dir,
              recursive=True,
              log=self.log.info)

        junk = [
            join(self.locale_dir, "komodo-js-api.toc"),
            join(self.locale_dir, "manifest.ini"),
            join(self.locale_dir, "toc.xml")
        ]
        for path in junk:
            if exists(path):
                sh.rm(path, log=self.log)

        help_toc_rdf = join(self.locale_dir, "help-toc.rdf")
        try:
            sh.run(
                "python support/tocxml2helptocrdf.py %s > %s" %
                (join(self.htdocs_dir, "toc.xml"), help_toc_rdf),
                self.log.info)
        except:
            if exists(help_toc_rdf):
                sh.rm(help_toc_rdf)
            raise
Esempio n. 4
0
 def svn_addremove(self):
     """Run svn add/remove operations for new/deleted files
     """
     self.log.info("Updating subversion...")
     from xml.etree.ElementTree import ElementTree
     xml = ElementTree()
     xml.parse(os.popen("svn st %s --xml" % self.dst_dir))
     for entry in xml.findall("/target/entry"):
         path = entry.attrib['path']
         if path.endswith(".orig"):
             continue
         status = entry.find("wc-status").attrib['item']
         if status == 'unversioned':
             sh.run("svn add %s" % path)
         elif status == 'missing':
             sh.run("svn remove %s" % path)
         elif status in ('modified', 'added'):
             pass # ignore
         else:
             self.log.warn("Unknown svn status: %s" % status)
Esempio n. 5
0
    def make(self):
        ver = _get_version()
        dist_dir = join(self.dir, "dist")

        paths = [join(dist_dir, "go-%s%s" % (ver, ext)) for ext in [".web"]]

        # Upload the bits.
        user = "******"
        host = "trentm.com"
        remote_dir = "~/data/bits/go/%s" % _get_version()
        if sys.platform == "win32":
            ssh = "plink"
            scp = "pscp -unsafe"
        else:
            ssh = "ssh"
            scp = "scp"
        sh.run("%s %s@%s 'mkdir -p %s'" % (ssh, user, host, remote_dir),
               self.log.info)
        for path in paths:
            sh.run("%s %s %s@%s:%s" % (scp, path, user, host, remote_dir),
                   self.log.info)
Esempio n. 6
0
    def make(self):
        ver = _get_version()
        dist_dir = join(self.dir, "dist")

        paths = [join(dist_dir, "go-%s%s" % (ver, ext))
                 for ext in [".web"]]

        # Upload the bits.
        user = "******"
        host = "trentm.com"
        remote_dir = "~/data/bits/go/%s" % _get_version()
        if sys.platform == "win32":
            ssh = "plink"
            scp = "pscp -unsafe"
        else:
            ssh = "ssh"
            scp = "scp"
        sh.run("%s %s@%s 'mkdir -p %s'" % (ssh, user, host, remote_dir),
               self.log.info)
        for path in paths:
            sh.run("%s %s %s@%s:%s" % (scp, path, user, host, remote_dir),
                   self.log.info)
Esempio n. 7
0
    def make(self):
        DRY_RUN = False
        version = self._get_version()

        # Confirm
        if not DRY_RUN:
            answer = query_yes_no("* * *\n"
                "Are you sure you want cut a %s release?\n"
                "This will involved commits and a release to pypi." % version,
                default="no")
            if answer != "yes":
                self.log.info("user abort")
                return
            print "* * *"
        self.log.info("cutting a %s release", version)

        # Checks: Ensure there is a section in changes for this version.
        changes_path = join(self.dir, "CHANGES.rst")
        changes_txt = changes_txt_before = codecs.open(changes_path, 'r', 'utf-8').read()
        raise NotImplementedError('_changes_parser: change me to .rst')
        changes_sections = self._changes_parser.findall(changes_txt)
        top_ver = changes_sections[0][0]
        if top_ver != version:
            raise MkError("top section in `CHANGES.rst' is for "
                "version %r, expected version %r: aborting"
                % (top_ver, version))
        top_nyr = changes_sections[0][1]
        if not top_nyr:
            answer = query_yes_no("\n* * *\n"
                "The top section in `CHANGES.rst' doesn't have the expected\n"
                "'(not yet released)' marker. Has this been released already?",
                default="yes")
            if answer != "no":
                self.log.info("abort")
                return
            print "* * *"
        top_body = changes_sections[0][2]
        if top_body.strip() == "(nothing yet)":
            raise MkError("top section body is `(nothing yet)': it looks like "
                "nothing has been added to this release")

        # Commits to prepare release.
        changes_txt = changes_txt.replace(" (not yet released)", "", 1)
        if not DRY_RUN and changes_txt != changes_txt_before:
            self.log.info("prepare `CHANGES.rst' for release")
            f = codecs.open(changes_path, 'w', 'utf-8')
            f.write(changes_txt)
            f.close()
            sh.run('git commit %s -m "prepare for %s release"'
                % (changes_path, version), self.log.debug)

        # Tag version and push.
        curr_tags = set(t for t in _capture_stdout(["git", "tag", "-l"]).split('\n') if t)
        if not DRY_RUN and version not in curr_tags:
            self.log.info("tag the release")
            sh.run('git tag -a "%s" -m "version %s"' % (version, version),
                self.log.debug)
            sh.run('git push --tags', self.log.debug)

        # Release to PyPI.
        self.log.info("release to pypi")
        if not DRY_RUN:
            mk("pypi_upload")

        # Commits to prepare for future dev and push.
        next_version = self._get_next_version(version)
        self.log.info("prepare for future dev (version %s)", next_version)
        marker = "## %s %s\n" % (self.proj_name, version)
        if marker not in changes_txt:
            raise MkError("couldn't find `%s' marker in `%s' "
                "content: can't prep for subsequent dev" % (marker, changes_path))
        changes_txt = changes_txt.replace("## %s %s\n" % (self.proj_name, version),
            "## %s %s (not yet released)\n\n(nothing yet)\n\n## %s %s\n" % (
                self.proj_name, next_version, self.proj_name, version))
        if not DRY_RUN:
            f = codecs.open(changes_path, 'w', 'utf-8')
            f.write(changes_txt)
            f.close()

        ver_path = join(self.dir, normpath(self.version_py_path))
        ver_content = codecs.open(ver_path, 'r', 'utf-8').read()
        version_tuple = self._tuple_from_version(version)
        next_version_tuple = self._tuple_from_version(next_version)
        marker = "__version_info__ = %r" % (version_tuple,)
        if marker not in ver_content:
            raise MkError("couldn't find `%s' version marker in `%s' "
                "content: can't prep for subsequent dev" % (marker, ver_path))
        ver_content = ver_content.replace(marker,
            "__version_info__ = %r" % (next_version_tuple,))
        if not DRY_RUN:
            f = codecs.open(ver_path, 'w', 'utf-8')
            f.write(ver_content)
            f.close()

        if not DRY_RUN:
            sh.run('git commit %s %s -m "prep for future dev"' % (
                changes_path, ver_path))
            sh.run('git push')
Esempio n. 8
0
 def make(self):
     sh.run("python toxbootstrap.py")
Esempio n. 9
0
    def make(self):
        DRY_RUN = False
        version = self._get_version()

        # Confirm
        if not DRY_RUN:
            answer = query_yes_no(
                "* * *\n"
                "Are you sure you want cut a %s release?\n"
                "This will involved commits and a release to pypi." % version,
                default="no")
            if answer != "yes":
                self.log.info("user abort")
                return
            print "* * *"
        self.log.info("cutting a %s release", version)

        # Checks: Ensure there is a section in changes for this version.
        changes_path = join(self.dir, "CHANGES.md")
        changes_txt = changes_txt_before = codecs.open(changes_path, 'r',
                                                       'utf-8').read()
        changes_sections = self._changes_parser.findall(changes_txt)
        top_ver = changes_sections[0][0]
        if top_ver != version:
            raise MkError("top section in `CHANGES.md' is for "
                          "version %r, expected version %r: aborting" %
                          (top_ver, version))
        top_nyr = changes_sections[0][1]
        if not top_nyr:
            answer = query_yes_no(
                "\n* * *\n"
                "The top section in `CHANGES.md' doesn't have the expected\n"
                "'(not yet released)' marker. Has this been released already?",
                default="yes")
            if answer != "no":
                self.log.info("abort")
                return
            print "* * *"
        top_body = changes_sections[0][2]
        if top_body.strip() == "(nothing yet)":
            raise MkError("top section body is `(nothing yet)': it looks like "
                          "nothing has been added to this release")

        # Commits to prepare release.
        changes_txt = changes_txt.replace(" (not yet released)", "", 1)
        if not DRY_RUN and changes_txt != changes_txt_before:
            self.log.info("prepare `CHANGES.md' for release")
            f = codecs.open(changes_path, 'w', 'utf-8')
            f.write(changes_txt)
            f.close()
            sh.run(
                'git commit %s -m "prepare for %s release"' %
                (changes_path, version), self.log.debug)

        # Tag version and push.
        curr_tags = set(
            t for t in _capture_stdout(["git", "tag", "-l"]).split('\n') if t)
        if not DRY_RUN and version not in curr_tags:
            self.log.info("tag the release")
            sh.run('git tag -a "%s" -m "version %s"' % (version, version),
                   self.log.debug)
            sh.run('git push --tags', self.log.debug)

        # Release to PyPI.
        self.log.info("release to pypi")
        if not DRY_RUN:
            mk("pypi_upload")

        # Commits to prepare for future dev and push.
        next_version = self._get_next_version(version)
        self.log.info("prepare for future dev (version %s)", next_version)
        marker = "## %s %s\n" % (self.proj_name, version)
        if marker not in changes_txt:
            raise MkError("couldn't find `%s' marker in `%s' "
                          "content: can't prep for subsequent dev" %
                          (marker, changes_path))
        changes_txt = changes_txt.replace(
            "## %s %s\n" % (self.proj_name, version),
            "## %s %s (not yet released)\n\n(nothing yet)\n\n## %s %s\n" %
            (self.proj_name, next_version, self.proj_name, version))
        if not DRY_RUN:
            f = codecs.open(changes_path, 'w', 'utf-8')
            f.write(changes_txt)
            f.close()

        ver_path = join(self.dir, normpath(self.version_py_path))
        ver_content = codecs.open(ver_path, 'r', 'utf-8').read()
        version_tuple = self._tuple_from_version(version)
        next_version_tuple = self._tuple_from_version(next_version)
        marker = "__version_info__ = %r" % (version_tuple, )
        if marker not in ver_content:
            raise MkError("couldn't find `%s' version marker in `%s' "
                          "content: can't prep for subsequent dev" %
                          (marker, ver_path))
        ver_content = ver_content.replace(
            marker, "__version_info__ = %r" % (next_version_tuple, ))
        if not DRY_RUN:
            f = codecs.open(ver_path, 'w', 'utf-8')
            f.write(ver_content)
            f.close()

        if not DRY_RUN:
            sh.run('git commit %s %s -m "prep for future dev"' %
                   (changes_path, ver_path))
            sh.run('git push')
Esempio n. 10
0
 def make(self):
     sh.run("python setup.py install")
     sh.run(
         "/Library/Frameworks/Python.framework/Versions/2.5/bin/preprocess foo.txt"
     )
Esempio n. 11
0
 def make(self):
     sh.run("python setup.py install")
     sh.run("/Library/Frameworks/Python.framework/Versions/2.5/bin/preprocess foo.txt")
Esempio n. 12
0
 def make(self):
     sh.run("python toxbootstrap.py")