Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Update aksetup.
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed May 30, 2013
1 parent 5f5509a commit d69e0b2
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions aksetup_helper.py
Expand Up @@ -39,7 +39,6 @@ def count_down_delay(delay):

def setup(*args, **kwargs):
from setuptools import setup
import traceback
try:
setup(*args, **kwargs)
except KeyboardInterrupt:
Expand Down Expand Up @@ -516,9 +515,16 @@ def __init__(self, lib_name, default=None, human_name=None, help=None):
% (human_name or humanize(lib_name))))

class BoostLibraries(Libraries):
def __init__(self, lib_base_name):
def __init__(self, lib_base_name, default_lib_name=None):
if default_lib_name is None:
if lib_base_name == "python":
import sys
default_lib_name = "boost_python-py%d%d" % sys.version_info[:2]
else:
default_lib_name = "boost_%s" % lib_base_name

Libraries.__init__(self, "BOOST_%s" % lib_base_name.upper(),
["boost_%s" % lib_base_name],
[default_lib_name],
help="Library names for Boost C++ %s library (without lib or .so)"
% humanize(lib_base_name))

Expand All @@ -539,8 +545,7 @@ def set_up_shipped_boost_if_requested(project_name, conf):
print("------------------------------------------------------------------------")
print("If you got this package from git, you probably want to do")
print("")
print(" $ git submodule init")
print(" $ git submodule update")
print(" $ git submodule update --init")
print("")
print("to fetch what you are presently missing. If you got this from")
print("a distributed package on the net, that package is broken and")
Expand Down Expand Up @@ -717,23 +722,16 @@ def substitute(substitutions, fname):
chmod(fname, infile_stat_res.st_mode)




def check_git_submodules():
from os.path import isdir
if not isdir(".git"):
# not a git repository
return

def _run_git_command(cmd):
git_error = None
from subprocess import Popen, PIPE
try:
popen = Popen(["git", "--version"], stdout=PIPE)
stdout_data, _ = popen.communicate()
popen = Popen(["git"] + cmd, stdout=PIPE)
stdout, stderr = popen.communicate()
if popen.returncode != 0:
git_error = "git returned error code %d" % popen.returncode
git_error = "git returned error code %d: %s" % (popen.returncode, stderr)
except OSError:
git_error = "(os error, likely git not found)"
git_error = "(OS error, likely git not found)"

if git_error is not None:
print("-------------------------------------------------------------------------")
Expand All @@ -747,17 +745,22 @@ def check_git_submodules():
print("Hit Ctrl-C now if you'd like to think about the situation.")
print("-------------------------------------------------------------------------")
count_down_delay(delay=5)
return stdout.decode("ascii"), git_error


def check_git_submodules():
from os.path import isdir
if not isdir(".git"):
# not a git repository
return

popen = Popen(["git", "submodule", "status"], stdout=PIPE)
stdout_data, _ = popen.communicate()
stdout_data = stdout_data.decode("ascii")
if popen.returncode != 0:
git_error = "git returned error code %d" % popen.returncode
stdout, git_error = _run_git_command(["submodule", "status"])
if git_error is not None:
return

pkg_warnings = []

lines = stdout_data.split("\n")
lines = stdout.split("\n")
for l in lines:
if not l.strip():
continue
Expand Down Expand Up @@ -787,8 +790,7 @@ def check_git_submodules():
print("-------------------------------------------------------------------------")
print("If this makes no sense, you probably want to say")
print("")
print(" $ git submodule init")
print(" $ git submodule update")
print(" $ git submodule update --init")
print("")
print("to fetch what you are presently missing and move on with your life.")
print("If you got this from a distributed package on the net, that package is")
Expand All @@ -798,20 +800,16 @@ def check_git_submodules():
for w in pkg_warnings:
print(" %s" % w)
print("")
print("I will try to continue after a short wait, fingers crossed.")
print("I will try to initialize the submodules for you after a short wait.")
print("-------------------------------------------------------------------------")
print("Hit Ctrl-C now if you'd like to think about the situation.")
print("-------------------------------------------------------------------------")

from os.path import exists
if not exists(".dirty-git-ok"):
count_down_delay(delay=10)









stdout, git_error = _run_git_command(["submodule", "update", "--init"])
if git_error is None:
print("-------------------------------------------------------------------------")
print("git submodules initialized successfully")
print("-------------------------------------------------------------------------")

0 comments on commit d69e0b2

Please sign in to comment.