Skip to content
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

lib50 2.1, Windows support #194

Closed
wants to merge 13 commits into from
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if __import__("os").name == "nt":
raise RuntimeError("submit50 does not support Windows directly. Instead, you should install the Windows Subsystem for Linux (https://docs.microsoft.com/en-us/windows/wsl/install-win10) and then install submit50 within that.")

from setuptools import setup
setup(
author="CS50",
Expand All @@ -15,7 +12,7 @@
'submit50': [('**.py', 'python', None),],
},
description="This is submit50, with which you can submit solutions to problems for CS50.",
install_requires=["lib50>=2,<3", "requests>=2.19", "termcolor>=1.1"],
install_requires=["lib50>=3,<4", "requests>=2.19", "termcolor>=1.1"],
keywords=["submit", "submit50"],
name="submit50",
python_requires=">=3.6",
Expand All @@ -25,6 +22,6 @@
entry_points={
"console_scripts": ["submit50=submit50.__main__:main"]
},
version="3.0.3",
version="3.0.4",
include_package_data=True
)
13 changes: 10 additions & 3 deletions submit50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import pkg_resources
import re
import readline
import shutil
import sys
import textwrap
Expand Down Expand Up @@ -62,24 +63,30 @@ def cprint(text="", color=None, on_color=None, attrs=None, **kwargs):
color=color, on_color=on_color, attrs=attrs, **kwargs)


def prompt(included, excluded):
def prompt(honesty, included, excluded):
if included:
cprint(_("Files that will be submitted:"), "green")
for file in included:
cprint("./{}".format(file), "green")
else:
raise Error(_("No files in this directory are expected for submission."))


# Files that won't be submitted
if excluded:
cprint(_("Files that won't be submitted:"), "yellow")
for other in excluded:
cprint("./{}".format(other), "yellow")

# Prompt for honesty
if not honesty:
return True
honesty = _("Keeping in mind the course's policy on "
"academic honesty, are you sure you want to "
"submit these files?")
readline.clear_history()
try:
answer = input(_("Keeping in mind the course's policy on academic honesty, "
"are you sure you want to submit these files (yes/no)? "))
answer = input(f"{_(honesty)} ({_('yes/no')}) ")
except EOFError:
answer = None
print()
Expand Down