Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ Updating `gsub --version` to return the right version number.
**Version 0.1.4:**

Support for python3.6

**Version 0.1.5:**

Updating `gsub update` to update submodules in case no .git folder is found
34 changes: 15 additions & 19 deletions gsub/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ def locate_git():


def show_help():
print("""usage: gsub [--version] [--help] <command> <args>
print(
"""usage: gsub [--version] [--help] <command> <args>

Commands:

list List all gsub folders.
freeze Update gsub files based on content of managed folders.
update Create/update managed folders based on gsub files.
vendor PATH Add a new gsub file.""")
vendor PATH Add a new gsub file."""
)
sys.exit(1)


def show_version():
print("gsub: v0.1.4")
print("gsub: v0.1.5")
raise SystemExit


Expand Down Expand Up @@ -114,7 +116,7 @@ def handle_list(root):
print("No .gsub files found in %s." % root)
return

maxsize = max(len(x[0]) for x in output)+1
maxsize = max(len(x[0]) for x in output) + 1
for x in output:
print(("%-" + str(maxsize) + "s %s") % (x[0] + ":", x[1]))
print(("%-" + str(maxsize) + "s Expected: %s@%s.") % ("", x[2], x[3][:10]))
Expand Down Expand Up @@ -147,9 +149,7 @@ def update_it(folder, name):
return "Error: failed to git url (%s)." % cgit

if cgit != git:
print(
"%s contains %s, expected %s, what to do?" % (rel, cgit, git)
)
print("%s contains %s, expected %s, what to do?" % (rel, cgit, git))
if six.moves.input("Nuke %s [y/N]: " % fbase).lower() == "y":
try:
shutil.rmtree(fbase)
Expand Down Expand Up @@ -187,11 +187,7 @@ def update_it(folder, name):
return rel, "Error: could not checkout (%s)." % err.strip()
return rel, "Cloned %s @%s, latest was %s." % (git, commit, version)

print(
"%s contains version %s, expected %s, what to do?" % (
rel, version, commit
)
)
print("%s contains version %s, expected %s, what to do?" % (rel, version, commit))

if six.moves.input("Checkout %s [y/N]: " % commit).lower() == "y":
err, code = o(fbase, "git fetch")
Expand Down Expand Up @@ -227,7 +223,7 @@ def handle_update(root):
def handle_vendor(pth):
pth = pth.rstrip("/")

dst = ("vendor/src/%s" % pth)
dst = "vendor/src/%s" % pth
print("mkdir -p", dst)
dstdad = dst.rsplit("/", 1)[0]

Expand All @@ -236,10 +232,7 @@ def handle_vendor(pth):
print(dstdad, pth, giturl, gclone)

if not os.path.isdir("./vendor/src/"):
print(
"There is no vendor folder in this directory. "
"Do I create it? (y/N) "
)
print("There is no vendor folder in this directory. " "Do I create it? (y/N) ")

if six.moves.input().lower() != "y":
sys.exit(1)
Expand Down Expand Up @@ -292,7 +285,8 @@ def main():
root = locate_git()
if not root:
print("not a git repo")
return
root = os.getcwd()
print("running in path: " + str(root))

if first == "list":
handle_list(root)
Expand All @@ -307,5 +301,7 @@ def main():
second = sys.argv[2].replace("https://", "")
handle_vendor(second)

if __name__ == '__main__':


if __name__ == "__main__":
main()
64 changes: 22 additions & 42 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,34 @@
setup(
name="gsub",
description="Replacement for git-submodule",

version="0.1.4",

version="0.1.5",
author="Amit Upadhyay",
author_email="code@amitu.com",

url="https://github.com/Coverfox/gsub",
license="BSD",


install_requires=["click==6.6", "six"],

packages=['gsub'],
packages=["gsub"],
zip_safe=True,


keywords=['git', 'git submodule'],


keywords=["git", "git submodule"],
classifiers=[

'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: System Administrators',
'Intended Audience :: Information Technology',
'Intended Audience :: Other Audience',

'Natural Language :: English',

'Operating System :: OS Independent',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',

'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',

'Topic :: Software Development',

"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: System Administrators",
"Intended Audience :: Information Technology",
"Intended Audience :: Other Audience",
"Natural Language :: English",
"Operating System :: OS Independent",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Software Development",
],
entry_points={
'console_scripts': [
'gsub = gsub.main:main',
],
},
entry_points={"console_scripts": ["gsub = gsub.main:main",],},
)