-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python setup.py install works without git submodule being initialized #26
Comments
@mithro Do you want to fix this, and thoroughly test that you have not broken anything? setuptools is brimming with ridiculous design flaws, and doing seemingly simple things like this often means opening a whole can of worms. |
This is the code I came up with for litex's setup.py to check this. def check_submodules(basedir):
try:
modules = open(os.path.join(basedir, ".gitmodules")).read()
except FileNotFoundError as e:
return []
submodule_errors = []
for line in modules.splitlines():
match = re.search("path = (.+)", line)
if not match:
continue
modulepath = match.groups()[0]
fullpath = os.path.normpath(os.path.join(basedir, modulepath))
assert os.path.exists(fullpath)
assert os.path.isdir(fullpath)
if not os.path.exists(os.path.join(fullpath, ".git")):
submodule_errors.append(fullpath)
continue
submodule_errors += check_submodules(fullpath)
return submodule_errors
if sys.version_info[:3] < (3, 3):
raise SystemExit("You need Python 3.3+")
submodule_errors = check_submodules(os.path.dirname(__file__))
if submodule_errors:
raise SystemExit("""\
The following git submodules are not initialized:{}
Please run:
git submodule update --recursive --init
git submodule foreach git submodule update --recursive --init
""".format("\n * ".join([""]+submodule_errors))) Do you think something similar would be suitable for misoc? |
Parsing |
I would say it is not especially fragile if fixed to ignore whitespace, and take end-of-line/beginning-of-line into account. I.e. |
I think launching a subprocess (and parsing its output) is likely to be more fragile than parsing the |
I forgot to init the submodules when cloning misoc. Running
python setup.py install
worked fine but I later got an error like the following when trying to build;Running
git submodule update --init
in the misoc directory and thenpython setup.py install
again fixed the problem.python setup.py install
should probably complain if it can't find the needed files from submodules.The text was updated successfully, but these errors were encountered: