# Path: alibuild_helpers/cmd.py
# def getstatusoutput(command):
#   """Run command and return its return code and output (stdout and stderr)."""
#   kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
#   proc = Popen(command, shell=is_string(command), stdout=PIPE, stderr=STDOUT,
#                universal_newlines=True, **kwargs)
#   merged_output, _ = proc.communicate()
#   # Strip a single trailing newline, if one exists, to match the behaviour of
#   # subprocess.getstatusoutput.
#   if merged_output.endswith("\n"):
#     merged_output = merged_output[:-1]
#   return proc.returncode, merged_output
# 
# Path: alibuild_helpers/log.py
# def dieOnError(err, msg):
#   def __init__(self, fmtstr):
#   def format(self, record):
#   def __init__(self, begin_msg=""):
#   def __call__(self, txt, *args):
#   def erase(self):
#   def end(self, msg="", error=False):
# def log_banner(self, message, *args, **kws):
# def log_success(self, message, *args, **kws):
# class LogFormatter(logging.Formatter):
# class ProgressPrint:


import os, subprocess, sys
from os.path import exists, expanduser
from os import unlink
from alibuild_helpers.cmd import getstatusoutput
from alibuild_helpers.log import debug, banner
#!/usr/bin/env python



def generate_analytics_id():
  getstatusoutput("mkdir -p  ~/.config/alibuild")
  err, output = getstatusoutput("uuidgen >  ~/.config/alibuild/analytics-uuid")
  # If an error is found while generating the unique user ID, we disable
  # the analytics on the machine.
  if err:
    debug("Could not generate unique ID for user. Disabling analytics")

# Path: alibuild_helpers/cmd.py
# def getstatusoutput(command):
#   """Run command and return its return code and output (stdout and stderr)."""
#   kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
#   proc = Popen(command, shell=is_string(command), stdout=PIPE, stderr=STDOUT,
#                universal_newlines=True, **kwargs)
#   merged_output, _ = proc.communicate()
#   # Strip a single trailing newline, if one exists, to match the behaviour of
#   # subprocess.getstatusoutput.
#   if merged_output.endswith("\n"):
#     merged_output = merged_output[:-1]
#   return proc.returncode, merged_output
# 
# Path: alibuild_helpers/log.py
# def dieOnError(err, msg):
#   def __init__(self, fmtstr):
#   def format(self, record):
#   def __init__(self, begin_msg=""):
#   def __call__(self, txt, *args):
#   def erase(self):
#   def end(self, msg="", error=False):
# def log_banner(self, message, *args, **kws):
# def log_success(self, message, *args, **kws):
# class LogFormatter(logging.Formatter):
# class ProgressPrint:


# Path: alibuild_helpers/analytics.py
import os, subprocess, sys
from os.path import exists, expanduser
from os import unlink
from alibuild_helpers.cmd import getstatusoutput
from alibuild_helpers.log import debug, banner

#!/usr/bin/env python



def generate_analytics_id():
  getstatusoutput("mkdir -p  ~/.config/alibuild")
  err, output = getstatusoutput("uuidgen >  ~/.config/alibuild/analytics-uuid")
  # If an error is found while generating the unique user ID, we disable
  # the analytics on the machine.
  if err:
    debug("Could not generate unique ID for user. Disabling analytics")

    getstatusoutput("touch ~/.config/alibuild/disable-analytics")