from setuptools import setup
from wheel.bdist_wheel import bdist_wheel
from datetime import datetime
from subprocess import Popen, PIPE
from distutils.util import get_platform
from distutils.core import Extension, Distribution
version_args = list(filter(lambda x: x.startswith('--build='),sys.argv))
if len(version_args) > 1:
datetime.now().timetuple().tm_yday
print("only one '--build=<num>.<num>.<num>' parameter can be specified")
pyversion = float(sys.version_info[0]) + float(sys.version_info[1]) / 10.0
return bytes(s,sys.getdefaultencoding())
return bs.decode(sys.getdefaultencoding(),"strict")
if isinstance(output,bytes) or isinstance(output,bytearray):
return str_decode(output)
elif isinstance(output,tuple):
return (str_decode(output[0]),str_decode(output[1]))
if len(version_args) != 0:
version_arg=version_args.pop(0).split("=")[1]
print (version_arg.split("."))
(major, minor, patch) = version_arg.split(".")
return(int(major), int(minor), int(patch))
proc = Popen( [ "../../scripts/version" ], stdout=PIPE, stderr=PIPE )
out,err = pipe_decode(proc.communicate( ))
devbranchtag = out.split(" ")[0].strip()
releasetag = out.split(" ")[1].strip()
if (len(out.split(" ")) == 3):
print("Latest commit doesn't have a tag. Adding -dirty flag to version string.")
dirty="+" + out.split(" ")[2].strip() # "+" denotes local version identifier as described in PEP440
if (devbranchtag != releasetag):
devbranchrevision = devbranchtag.split("-")[-1]
if (devbranchtag.startswith("CAS-")):
devbranchversion=devbranchtag.split("-")[1]
devbranchrevision = devbranchtag.split("-")[-1]
proc = Popen( [ "../../scripts/version" ], stdout=PIPE, stderr=PIPE )
out,err = proc.communicate( )
(major, minor, patch) = out.decode("utf-8").split(".")
print((major,minor, patch))
return(int(major), int(minor), int(patch))
(major, minor, patch) = releasetag.split(".")
#print(major, minor, patch, feature, devbranchversion, devbranchrevision, dirty)
return(int(major), int(minor), int(patch), devbranchversion, devbranchrevision, dirty)
(casaviewer_major,casaviewer_minor, casaviewer_patch) = compute_version( )
casaviewer_version = '%d.%d.%d' % (casaviewer_major,casaviewer_minor,casaviewer_patch)
(major, minor, patch, devbranchversion, devbranchrevision, dirty) = compute_version( )
print(major, minor, patch, devbranchversion, devbranchrevision, dirty)
casaviewer_version = '%d.%d.%d%s' % (major,minor,patch,dirty)
if devbranchversion !="":
casaviewer_version = '%d.%d.%da%s.dev%s%s' % (major,minor,patch,devbranchversion,devbranchrevision,dirty)
print(casaviewer_version)
for root, directories, filenames in os.walk(dir):
r = os.path.join(*root.split(os.sep)[1:])
for filename in filenames:
acc.append(os.path.join(r,filename))
class BinaryDistribution(Distribution):