def _version_from_git_describe():
 p = subprocess.Popen(['git', 'describe', '--always'], cwd=_SCAPY_PKG_DIR, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 (out, err) = p.communicate()
 if (p.returncode == 0):
  tag = out.strip()
  match = re.match('^v?(.+?)-(\\d+)-g[a-f0-9]+$', tag)
  if match:
   return ('%s.dev%s' % (match.group(1), match.group(2)))
  else:
   return re.sub('^v', '', tag)
 else:
  raise subprocess.CalledProcessError(p.returncode, err)

def _version_from_git_describe ( ) : p = subprocess . Popen ( [ 'git' , 'describe' , '--always' ] , cwd = _SCAPY_PKG_DIR , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( out , err ) = p . communicate ( ) if ( p . returncode == 0 ) : tag = out . strip ( ) match = re . match ( '^v?(.+?)-(\\d+)-g[a-f0-9]+$' , tag ) if match : return ( '%s.dev%s' % ( match . group ( 1 ) , match . group ( 2 ) ) ) else : return re . sub ( '^v' , '' , tag ) else : raise subprocess . CalledProcessError ( p . returncode , err )
read the version from git describe .