Skip to content

Commit 26cbd25

Browse files
authored
Merge pull request #116 from cs50/develop
Deploy submit50 v2.4.0
2 parents a8ace98 + 96d7764 commit 26cbd25

File tree

3 files changed

+114
-83
lines changed

3 files changed

+114
-83
lines changed

locale/es/LC_MESSAGES/messages.po

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -44,107 +44,129 @@ msgstr "¡Lo siento, algo está mal! ¡Déjale saber a sysadmins@cs50.harvard.ed
4444
msgid "Submission cancelled."
4545
msgstr "La entrega se canceló."
4646

47-
#: submit50.py:386
48-
msgid "You don't have git. Install git, then re-run submit50!"
49-
msgstr "No tienes git. ¡Instala git, y luego vuelve a ejecutar submit50!"
47+
#: submit50.py:391
48+
msgid "You don't have git. Install git, then re-run {}!"
49+
msgstr "No tienes git. ¡Instala git, y luego vuelve a ejecutar {}!"
5050

51-
#: submit50.py:390
51+
#: submit50.py:395
5252
msgid ""
53-
"You have an old version of git. Install version 2.7 or later, then re-run "
54-
"submit50!"
53+
"You have an old version of git. Install version 2.7 or later, then re-run {}!"
5554
msgstr ""
56-
"Tienes una versión antigua de git. ¡Instala la versión 2.7 o superior, y "
57-
"vuelve a ejecutar submit50!"
5855

59-
#: submit50.py:404
56+
#: submit50.py:409
6057
msgid ""
6158
"You have an unknown version of submit50. Email sysadmins@cs50.harvard.edu!"
6259
msgstr ""
6360
"Tienes una versión desconocida de submit50. ¡Escríbele a sysadmins@cs50."
6461
"harvard.edu!"
6562

66-
#: submit50.py:408
67-
msgid ""
68-
"You have an old version of submit50. Run update50, then re-run submit50!"
63+
#: submit50.py:413
64+
msgid "You have an old version of submit50. Run update50, then re-run {}!"
6965
msgstr ""
7066
"Tienes una versión antigua de submit50. ¡Ejecuta update50, y luego vuelve a "
71-
"ejecutar submit50!"
67+
"ejecutar {}!"
7268

73-
#: submit50.py:425
69+
#: submit50.py:430
7470
msgid "Invalid problem. Did you mean to submit something else?"
7571
msgstr "El problema no es válido. ¿Quisiste entregar algo más?"
7672

77-
#: submit50.py:441
73+
#: submit50.py:446
7874
msgid "You seem to be missing these files:"
7975
msgstr "Parece que faltan estos archivos:"
8076

81-
#: submit50.py:444
77+
#: submit50.py:449
8278
msgid "Ensure you have the required files before submitting."
8379
msgstr "Asegúrate de tener los archivos necesarios antes de entregar."
8480

85-
#: submit50.py:447
81+
#: submit50.py:452
8682
msgid "Authenticating"
8783
msgstr "Autenticando"
8884

89-
#: submit50.py:465
85+
#: submit50.py:470
9086
msgid "Preparing"
9187
msgstr "Preparando"
9288

93-
#: submit50.py:472
89+
#: submit50.py:477
9490
msgid ""
95-
"Looks like submit50 isn't enabled for your account yet. Log into https://"
96-
"cs50.me/ in a browser, click \"Authorize application\", and re-run submit50 "
97-
"here!"
91+
"Looks like {} isn't enabled for your account yet. Log into https://cs50.me/ "
92+
"in a browser, click \"Authorize application\", and re-run {} here!"
9893
msgstr ""
99-
"Parece que submit50 todavía no está habilitado para tu cuenta. Inicie sesión "
100-
"en https://cs50.me/ en un navegador, haga clic en \"Autorizar la aplicación"
101-
"\", y vuelva a ejecutar submit50 ¡aquí!"
10294

103-
#: submit50.py:475
95+
#: submit50.py:480
10496
msgid ""
105-
"Looks like you have the wrong username in ~/.gitconfig or submit50 isn't yet "
97+
"Looks like you have the wrong username in ~/.gitconfig or {} isn't yet "
10698
"enabled for your account. Double-check ~/.gitconfig and then log into "
10799
"https://cs50.me/ in a browser, click \"Authorize application\" if prompted, "
108-
"and re-run submit50 here."
100+
"and re-run {} here."
101+
msgstr ""
102+
"Parece que tienes el nombre de usuario incorrecto en ~ /.gitconfig o {} aún "
103+
"no está habilitado para tu cuenta. Vuelve a chequear ~/.gitconfig y luego "
104+
"ingresa en https://cs50.me/ en un navegador, haga clic en \"Autorizar "
105+
"aplicación\" si se te solicita, y vuelve a ejecutar {} aquí."
106+
107+
#: submit50.py:525
108+
msgid ""
109+
"These files are too large to be submitted:\n"
110+
"{}\n"
111+
"Remove these files from your directory and then re-run {}!"
112+
msgstr ""
113+
114+
#: submit50.py:530
115+
msgid ""
116+
"These files are too large to be submitted:\n"
117+
"{}\n"
118+
"Install git-lfs (or remove these files from your directory) and then re-run "
119+
"{}!"
109120
msgstr ""
110-
"Parece que tienes el nombre de usuario incorrecto en ~ /.gitconfig o "
111-
"submit50 aún no está habilitado para tu cuenta. Vuelve a chequear ~/."
112-
"gitconfig y luego ingresa en https://cs50.me/ en un navegador, haga clic en "
113-
"\"Autorizar aplicación\" si se te solicita, y vuelve a ejecutar submit50 "
114-
"aquí."
115121

116-
#: submit50.py:536
122+
#: submit50.py:541
117123
msgid "No files in this directory are expected for submission."
118124
msgstr "Ningún archivo en este directorio se espera para la entrega."
119125

120-
#: submit50.py:537
126+
#: submit50.py:544
121127
msgid "Files that will be submitted:"
122128
msgstr "Archivos que se van a entregar:"
123129

124-
#: submit50.py:543
130+
#: submit50.py:550
125131
msgid "Files that won't be submitted:"
126132
msgstr "Archivos que no se van a entregar:"
127133

128-
#: submit50.py:548
134+
#: submit50.py:554
129135
msgid ""
130136
"Keeping in mind the course's policy on academic honesty, are you sure you "
131137
"want to submit these files? "
132138
msgstr ""
133139
"Teniendo en cuenta la política de honestidad académica del curso, ¿estás "
134140
"seguro que quieres enviar estos archivos? "
135141

136-
#: submit50.py:551
142+
#: submit50.py:557
137143
msgid "No files were submitted."
138144
msgstr ""
139145

140-
#: submit50.py:554
146+
#: submit50.py:560
141147
msgid "Submitting"
142148
msgstr "Entregando"
143149

144-
#: submit50.py:561
145-
msgid "Submitted {}! See https://cs50.me/submissions/{}."
146-
msgstr "¡Se entregó {}! Puedes ver https://cs50.me/submissions/{}."
150+
#: submit50.py:568
151+
msgid "Submitted {}! See https://cs50.me/submissions."
152+
msgstr "¡Se entregó {}! Puedes ver https://cs50.me/submissions."
147153

148-
#: submit50.py:608
154+
#: submit50.py:615
149155
msgid "Could not complete two-factor authentication."
150156
msgstr "No se pudo completar la autenticación de dos factores."
157+
158+
#~ msgid ""
159+
#~ "You have an old version of git. Install version 2.7 or later, then re-run "
160+
#~ "submit50!"
161+
#~ msgstr ""
162+
#~ "Tienes una versión antigua de git. ¡Instala la versión 2.7 o superior, y "
163+
#~ "vuelve a ejecutar submit50!"
164+
165+
#~ msgid ""
166+
#~ "Looks like {} isn't enabled for your account yet. Log into https://cs50."
167+
#~ "me/ in a browser, click \"Authorize application\", and re-run submit50 "
168+
#~ "here!"
169+
#~ msgstr ""
170+
#~ "Parece que {} todavía no está habilitado para tu cuenta. Inicie sesión en "
171+
#~ "https://cs50.me/ en un navegador, haga clic en \"Autorizar la aplicación"
172+
#~ "\", y vuelva a ejecutar submit50 ¡aquí!"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ class CustomInstall(install):
6161
"console_scripts": ["submit50=submit50:main"]
6262
},
6363
url="https://github.com/cs50/submit50",
64-
version="2.3.1"
64+
version="2.4.0"
6565
)

submit50.py

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def progress_helper():
377377
progress.progressing = False
378378

379379

380-
def submit(org, problem):
380+
def submit(org, branch):
381381
"""Submit problem."""
382382

383383
# check announcements
@@ -388,11 +388,11 @@ def submit(org, problem):
388388
# require git 2.7+, so that credential-cache--daemon ignores SIGHUP
389389
# https://github.com/git/git/blob/v2.7.0/credential-cache--daemon.c
390390
if not which("git"):
391-
raise Error(_("You don't have git. Install git, then re-run submit50!"))
391+
raise Error(_("You don't have git. Install git, then re-run {}!".format(org)))
392392
version = subprocess.check_output(["git", "--version"]).decode("utf-8")
393393
matches = re.search(r"^git version (\d+\.\d+\.\d+).*$", version)
394394
if not matches or StrictVersion(matches.group(1)) < StrictVersion("2.7.0"):
395-
raise Error(_("You have an old version of git. Install version 2.7 or later, then re-run submit50!"))
395+
raise Error(_("You have an old version of git. Install version 2.7 or later, then re-run {}!".format(org)))
396396

397397
# update progress
398398
progress("Connecting")
@@ -411,16 +411,20 @@ def submit(org, problem):
411411
version_required = res.text.strip()
412412
if parse_version(version_required) > parse_version(get_distribution("submit50").version):
413413
raise Error(_("You have an old version of submit50. "
414-
"Run update50, then re-run submit50!"))
414+
"Run update50, then re-run {}!".format(org)))
415415

416-
# assume cs50/ problem if problem name begins with a year
417-
branch = problem
418-
if problem.split("/")[0].isdigit():
419-
branch = os.path.join("cs50", problem)
416+
file, submit.EXCLUDE = tempfile.mkstemp()
417+
418+
# separate branch into problem slug and source repo
419+
check_repo = "@cs50/checks"
420+
branch = branch if not branch.endswith(check_repo) else branch[:-len(check_repo)]
421+
try:
422+
slug, src = branch.split("@")
423+
except ValueError:
424+
slug, src = branch, "cs50/checks"
420425

421426
# ensure problem exists
422-
file, submit.EXCLUDE = tempfile.mkstemp()
423-
url = "https://cs50.me/excludes/{}/".format(branch)
427+
url = "https://raw.githubusercontent.com/{}/master/{}/submit50/exclude".format(src, slug)
424428
try:
425429
urllib.request.urlretrieve(url, filename=submit.EXCLUDE)
426430
lines = open(submit.EXCLUDE)
@@ -474,12 +478,12 @@ def submit(org, problem):
474478
run("git clone --bare {} {}".format(shlex.quote(repo), shlex.quote(run.GIT_DIR)), password=password)
475479
except:
476480
if password:
477-
e = Error(_("Looks like submit50 isn't enabled for your account yet. "
478-
"Log into https://cs50.me/ in a browser, click \"Authorize application\", and re-run submit50 here!"))
481+
e = Error(_("Looks like {} isn't enabled for your account yet. "
482+
"Log into https://cs50.me/ in a browser, click \"Authorize application\", and re-run {} here!".format(org, org)))
479483
else:
480-
e = Error(_("Looks like you have the wrong username in ~/.gitconfig or submit50 isn't yet enabled for your account. "
484+
e = Error(_("Looks like you have the wrong username in ~/.gitconfig or {} isn't yet enabled for your account. "
481485
"Double-check ~/.gitconfig and then log into https://cs50.me/ in a browser, "
482-
"click \"Authorize application\" if prompted, and re-run submit50 here."))
486+
"click \"Authorize application\" if prompted, and re-run {} here.".format(org, org)))
483487
e.__cause__ = None
484488
raise e
485489

@@ -525,14 +529,14 @@ def submit(org, problem):
525529
elif size > (2 * 1024 * 1024 * 1024):
526530
huge.append(file)
527531
if len(huge) > 0:
528-
raise Error("These files are too large to be submitted:\n{}\n"
529-
"Remove these files from your directory "
530-
"and then re-run submit50!".format("\n".join(huge)))
532+
raise Error(_("These files are too large to be submitted:\n{}\n"
533+
"Remove these files from your directory "
534+
"and then re-run {}!").format("\n".join(huge), org))
531535
elif len(large) > 0:
532536
if not which("git-lfs"):
533-
raise Error("These files are too large to be submitted:\n{}\n"
534-
"Install git-lfs (or remove these files from your directory) "
535-
"and then re-run submit50!".format("\n".join(large)))
537+
raise Error(_("These files are too large to be submitted:\n{}\n"
538+
"Install git-lfs (or remove these files from your directory) "
539+
"and then re-run {}!").format("\n".join(large), org))
536540
run("git lfs install --local")
537541
run("git config credential.helper cache") # for pre-push hook
538542
for file in large:
@@ -542,33 +546,38 @@ def submit(org, problem):
542546
# files that will be submitted
543547
if len(files) == 0:
544548
raise Error(_("No files in this directory are expected for submission."))
545-
cprint(_("Files that will be submitted:"), "green")
546-
for f in files:
547-
cprint("./{}".format(f), "green")
548-
549-
# files that won't be submitted
550-
if len(other) != 0:
551-
cprint(_("Files that won't be submitted:"), "yellow")
552-
for f in other:
553-
cprint("./{}".format(f), "yellow")
554-
555-
# prompt for academic honesty
556-
answer = input(_("Keeping in mind the course's policy on academic honesty, "
557-
"are you sure you want to submit these files? "))
558-
if not re.match("^\s*(?:y|yes)\s*$", answer, re.I):
559-
raise Error(_("No files were submitted."))
549+
550+
if org == "submit50":
551+
cprint(_("Files that will be submitted:"), "green")
552+
for f in files:
553+
cprint("./{}".format(f), "green")
554+
555+
# files that won't be submitted
556+
if len(other) != 0:
557+
cprint(_("Files that won't be submitted:"), "yellow")
558+
for f in other:
559+
cprint("./{}".format(f), "yellow")
560+
561+
answer = input(_("Keeping in mind the course's policy on academic honesty, "
562+
"are you sure you want to submit these files? "))
563+
if not re.match("^\s*(?:y|yes)\s*$", answer, re.I):
564+
raise Error(_("No files were submitted."))
560565

561566
# update progress
562-
progress(_("Submitting"))
567+
progress(_("Submitting" if org == "submit50" else "Uploading"))
563568

564569
# push branch
565570
run("git commit --allow-empty --message='{}'".format(timestamp))
571+
commit_hash = run("git rev-parse HEAD")
566572
run("git push origin 'refs/heads/{}'".format(branch), password=password)
567573

568574
# successful submission
569-
cprint(_("Submitted {}! "
570-
"See https://cs50.me/submissions/{}.").format(problem, branch),
571-
"green")
575+
if org == "submit50":
576+
cprint(_("Submitted {}! See https://cs50.me/submissions.").format(branch),
577+
"green")
578+
579+
progress(False)
580+
return username, commit_hash
572581

573582

574583
submit.ATTRIBUTES = None

0 commit comments

Comments
 (0)