Sassan Sassan - 2 months ago 14x
Git Question

How to make pip update submodules of a git repository?

I'm using pip for deploying my package and I want it to pull my package's submodules recursively whenever I upgrade my package, does anybody know how can I do so?


Whenever pip updates my repo, it runs with "develop" as its argument, so I changed my like this:

from distutils.core import setup
from setuptools.command.develop import develop
from subprocess import check_call
from os import path

class update_submodules(develop):
    def run(self):
        print 1
        if path.exists('.git'):
            check_call(['git', 'submodule', 'update', '--init', '--recursive'])

a = setup(cmdclass = {"develop": update_submodules},

it means that before running default procedure of " develop" run "git submodule update --init --recursive".