repository for casatablebrowser
Source
xxxxxxxxxx
package_data={"casatablebrowser": all_files("casatablebrowser/__bin__") + ["LICENSE.txt"]},
#!/usr/bin/env python3
import os
import sys
import setuptools
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
pyversion = float(sys.version_info[0]) + float(sys.version_info[1]) / 10.0
if pyversion < 3:
str_encode = str
str_decode = str
def pipe_decode(output):
return output
else:
def str_encode(s):
return bytes(s, sys.getdefaultencoding())
def str_decode(bs):
return bs.decode(sys.getdefaultencoding(), "strict")
def pipe_decode(output):
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]))
else:
return ("", "")
def compute_version():
print(os.getcwd())
proc = Popen(["../../scripts/version"], stdout=PIPE, stderr=PIPE)
out, err = pipe_decode(proc.communicate())
print(out)
devbranchtag = out.split(" ")[0].strip()
print(devbranchtag)
releasetag = out.split(" ")[1].strip()
dirty = ""
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
print(releasetag)
devbranchversion = ""
devbranchrevision = ""
if devbranchtag != releasetag:
devbranchrevision = devbranchtag.split("-")[-1]
if devbranchtag.startswith("CAS-"):
devbranchversion = devbranchtag.split("-")[1]
else:
devbranchversion = 100
devbranchrevision = devbranchtag.split("-")[-1]
else:
isDevBranch = False
try:
(major, minor, patch) = releasetag.split(".")
except ValueError:
print("Value Error")
(major, minor, patch) = (0, 0, 0)
# print(major, minor, patch, feature, devbranchversion, devbranchrevision, dirty)
return (
int(major),
int(minor),
int(patch),
devbranchversion,
devbranchrevision,
dirty,
)
(major, minor, patch, devbranchversion, devbranchrevision, dirty) = compute_version()
print(major, minor, patch, devbranchversion, devbranchrevision, dirty)
casatablebrowser_version = "%d.%d.%d%s" % (major, minor, patch, dirty)
if devbranchversion != "":
casatablebrowser_version = "%d.%d.%da%s.dev%s%s" % (
major,
minor,
patch,
devbranchversion,
devbranchrevision,
dirty,