Exemple #1
0
    def run(self):
        try:
            p = Popen('git log -1'.split(),
                      stdin=PIPE,
                      stdout=PIPE,
                      stderr=PIPE)
        except IOError:
            warn("No git found, skipping git revision")
            return

        if p.wait():
            warn("checking git branch failed")
            info(p.stderr.read())
            return

        line = p.stdout.readline().decode().strip()
        if not line.startswith('commit'):
            warn("bad commit line: %r" % line)
            return

        rev = line.split()[-1]

        # now that we have the git revision, we can apply it to version.py
        with open(self.version_py) as f:
            lines = f.readlines()

        for i, line in enumerate(lines):
            if line.startswith('__revision__'):
                lines[i] = "__revision__ = '%s'\n" % rev
                break
        with open(self.version_py, 'w') as f:
            f.writelines(lines)
 def run(self):
     try:
         p = Popen('git log -1'.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE)
     except IOError:
         warn("No git found, skipping git revision")
         return
     
     if p.wait():
         warn("checking git branch failed")
         info(p.stderr.read())
         return
     
     line = p.stdout.readline().decode().strip()
     if not line.startswith('commit'):
         warn("bad commit line: %r" % line)
         return
     
     rev = line.split()[-1]
     
     # now that we have the git revision, we can apply it to version.py
     with open(self.version_py) as f:
         lines = f.readlines()
     
     for i,line in enumerate(lines):
         if line.startswith('__revision__'):
             lines[i] = "__revision__ = '%s'\n"%rev
             break
     with open(self.version_py, 'w') as f:
         f.writelines(lines)
Exemple #3
0
def extract_version():
    """extract pyzmq version from sugar/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'sugar', 'version.py')) as f:
        while True:
            line = f.readline()
            if line.startswith('# Code'):
                lines = []
                while line and not line.startswith('def'):
                    lines.append(line)
                    line = f.readline()
                break
    exec(''.join(lines), globals())
    return __version__
Exemple #4
0
def extract_version():
    """extract pyzmq version from sugar/version.py, so it's not multiply defined"""
    with open(pjoin("zmq", "sugar", "version.py")) as f:
        while True:
            line = f.readline()
            if line.startswith("# Code"):
                lines = []
                while line and not line.startswith("def"):
                    lines.append(line)
                    line = f.readline()
                break
    exec("".join(lines), globals())
    return __version__
Exemple #5
0
def extract_version():
    """extract pyzmq version from sugar/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'sugar', 'version.py')) as f:
        while True:
            line = f.readline()
            if line.startswith('VERSION'):
                lines = ["from typing import *\n"]
                while line and not line.startswith('def'):
                    lines.append(line)
                    line = f.readline()
                break
    ns = {}
    exec(''.join(lines), ns)
    return ns['__version__']
def extract_version():
    """extract pyzmq version from sugar/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'sugar', 'version.py')) as f:
        line = f.readline()
        while not line.startswith("__version__"):
            line = f.readline()
    exec(line, globals())
    return __version__
def extract_version():
    """extract pyzmq version from sugar/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'sugar', 'version.py')) as f:
        line = f.readline()
        while not line.startswith("__version__"):
            line = f.readline()
    exec(line, globals())
    return __version__
Exemple #8
0
def extract_version():
    """extract pyzmq version from core/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'core', 'version.py')) as f:
        line = f.readline()
        while not line.startswith("__version__"):
            line = f.readline()
    exec(line, globals())
    if 'bdist_msi' in sys.argv:
        # msi has strict version requirements, which requires that
        # we strip any dev suffix
        return re.match(r'\d+(\.\d+)+', __version__).group()
    else:
        return __version__
Exemple #9
0
def extract_version():
    """extract pyzmq version from core/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'core', 'version.py')) as f:
        line = f.readline()
        while not line.startswith("__version__"):
            line = f.readline()
    exec(line, globals())
    if 'bdist_msi' in sys.argv:
        # msi has strict version requirements, which requires that
        # we strip any dev suffix
        return re.match(r'\d+(\.\d+)+', __version__).group()
    else:
        return __version__
Exemple #10
0
def extract_version():
    """extract pyzmq version from core/version.py, so it's not multiply defined"""
    with open(pjoin('zmq', 'core', 'version.py')) as f:
        line = f.readline()
        while not line.startswith("__version__"):
            line = f.readline()
    exec(line, globals())
    if 'bdist_msi' in sys.argv:
        # msi has strict version requirements, which requires that
        # we strip any dev suffix, and have at most two dots
        vlist = re.findall(r'\d+', __version__)
        vs = '.'.join(vlist[:3])
        if len(vlist) > 3:
            vs = '-'.join([vs] + vlist[3:])
        return vs
    else:
        return __version__