|
|
|
@ -18,21 +18,24 @@
|
|
|
|
|
# |
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
|
|
|
# along with python-packages-source. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
r"""Add git submodules to the repository.""" |
|
|
|
|
|
|
|
|
|
import shlex |
|
|
|
|
import contextlib |
|
|
|
|
import os |
|
|
|
|
import shlex |
|
|
|
|
|
|
|
|
|
import fpyutils |
|
|
|
|
import gitea |
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
SUBMODULES_DIRECTORY='../submodules' |
|
|
|
|
SUBMODULES_DIRECTORY = '../submodules' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# See |
|
|
|
|
# https://stackoverflow.com/a/13847807 |
|
|
|
|
# CC BY-SA 4.0 |
|
|
|
|
# spiralman, bryant1410 |
|
|
|
|
@contextlib.contextmanager |
|
|
|
|
def pushd(new_dir): |
|
|
|
|
def _pushd(new_dir): |
|
|
|
|
previous_dir = os.getcwd() |
|
|
|
|
os.chdir(new_dir) |
|
|
|
|
try: |
|
|
|
@ -43,10 +46,11 @@ def pushd(new_dir):
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
def main(): |
|
|
|
|
r"""Main.""" |
|
|
|
|
results = gitea.get_org_repos() |
|
|
|
|
|
|
|
|
|
# Get the original URLs of mirrors only. |
|
|
|
|
with pushd(SUBMODULES_DIRECTORY): |
|
|
|
|
with _pushd(SUBMODULES_DIRECTORY): |
|
|
|
|
for r in results: |
|
|
|
|
for rr in r: |
|
|
|
|
if rr['mirror'] and not rr['empty']: |
|
|
|
|