Skip to content
Snippets Groups Projects
Commit 584bd1cd authored by Mihai Patrascoiu's avatar Mihai Patrascoiu
Browse files

Use "python3" for Python scripts

parent 34070e81
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python2
#!/usr/bin/env python3
################################################################################
## Script to generate version numbers from git tags. ##
......@@ -20,7 +20,10 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>. ##
################################################################################
import os, subprocess, sys, argparse
import os
import sys
import argparse
import subprocess
def removePrefix(s, prefix):
if s.startswith(prefix):
......@@ -42,7 +45,8 @@ class SoftwareVersion:
self.patch = patch
self.miniPatch = miniPatch
if self.patch == None: assert self.miniPatch == None
if self.patch is None:
assert self.miniPatch is None
def toString(self):
ret = "{0}.{1}".format(self.major, self.minor)
......@@ -58,6 +62,13 @@ class SoftwareVersion:
class GitDescribe:
def __init__(self, description):
self.description = description
self.versionFragments = None
self.numberOfCommits = None
self.versionTriplet = None
self.commitHash = None
self.miniPatch = None
self.version = None
self.dirty = None
self.parse()
def parse(self):
......@@ -68,7 +79,7 @@ class GitDescribe:
if self.dirty:
parts = parts[0:len(parts)-len("-dirty")]
# Trim any preceeding "v" or "R" in the version, if any
# Trim any preceding "v" or "R" in the version, if any
parts = removePrefix(parts, "v")
parts = removePrefix(parts, "R_")
......@@ -96,7 +107,7 @@ class GitDescribe:
break
if not self.versionFragments:
raise Exception("Unable to parse vresion fragments of {0}".format(self.description))
raise Exception("Unable to parse version fragments of {0}".format(self.description))
if len(self.versionFragments) != 2 and len(self.versionFragments) != 3:
raise Exception("Unable to understand version fragments ({0}) of {1}".format(self.versionFragments, self.description))
......
#!/usr/bin/env python
#!/usr/bin/env python3
# Author: Georgios Bitzes <georgios.bitzes@cern.ch>
import os, subprocess, sys, inspect, argparse, re, shutil, errno
import os, subprocess, sys, argparse, re, shutil, errno
DRY_RUN = False
NO_CREATE_REPO = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment