# -*- coding: utf-8 -*-

import platform
import subprocess
import datetime

def update_package():
    if not platform.system() == 'Darwin':
        raise()


    print("[UTC %s] start downloading cots" % datetime.datetime.utcnow())
    #https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
    wget('http://srvtemplates.ad.tranquil.it/binary_cache/pkg-config-0.29.2.tar.gz', target=basedir, connect_timeout=60, resume=True, sha256='6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591')


    print("[UTC %s] start compiling pkgconfig" % datetime.datetime.utcnow())
    run('/bin/bash compile_pkgconfig.sh' )

    if params:
        commit_count = params.get("commit_count",0)
    else:
        val = subprocess.check_output('git rev-list --count HEAD', shell=True)
        commit_count = int(val)
    control.version = "%s-%s" % (control.version.split('-')[0], commit_count)
    control.save_control_to_wapt()
