# Path: liam2/compat.py
# PY2 = sys.version_info[0] == 2
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def csv_open(filename, mode='r'):
#     class metaclass(meta):


import errno
import fnmatch
import os
import re
import stat
import subprocess
import sys
import urllib
import zipfile
from datetime import date
from os import chdir, makedirs
from os.path import exists, abspath, dirname
from shutil import copytree, copy2, rmtree as _rmtree
from subprocess import check_output, STDOUT, CalledProcessError
from liam2.compat import input

WEBSITE = 'liam2.plan.be'
TMP_PATH = r"c:\tmp\liam2_new_release"
# not using tempfile.mkdtemp to be able to resume an aborted release
# TMP_PATH = os.path.join(tempfile.gettempdir(), "liam2_new_release")

# TODO:
# - different announce message for pre-releases
# - announce RC on the website too
# ? create a download page for the rc
# - create a conda environment to store requirements for the release
#   create -n liam2-{release} --clone liam2
#   or better yet, only store package versions:
#   conda env export > doc\bundle_environment.yml

# TODO: add more scripts to implement the "git flow" model
# - hotfix_branch
# - release_branch
# - feature_branch
# - make_release, detects hotfix or release


# ------------- #
# generic tools #
# ------------- #

def size2str(value):
    unit = "bytes"
    if value > 1024.0:
        value /= 1024.0

# Path: liam2/compat.py
# PY2 = sys.version_info[0] == 2
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def csv_open(filename, mode='r'):
#     class metaclass(meta):


# Path: make_release.py
import errno
import fnmatch
import os
import re
import stat
import subprocess
import sys
import urllib
import zipfile
from datetime import date
from os import chdir, makedirs
from os.path import exists, abspath, dirname
from shutil import copytree, copy2, rmtree as _rmtree
from subprocess import check_output, STDOUT, CalledProcessError
from liam2.compat import input


WEBSITE = 'liam2.plan.be'
TMP_PATH = r"c:\tmp\liam2_new_release"
# not using tempfile.mkdtemp to be able to resume an aborted release
# TMP_PATH = os.path.join(tempfile.gettempdir(), "liam2_new_release")

# TODO:
# - different announce message for pre-releases
# - announce RC on the website too
# ? create a download page for the rc
# - create a conda environment to store requirements for the release
#   create -n liam2-{release} --clone liam2
#   or better yet, only store package versions:
#   conda env export > doc\bundle_environment.yml

# TODO: add more scripts to implement the "git flow" model
# - hotfix_branch
# - release_branch
# - feature_branch
# - make_release, detects hotfix or release


# ------------- #
# generic tools #
# ------------- #

def size2str(value):
    unit = "bytes"
    if value > 1024.0:
        value /= 1024.0

        unit = "Kb"