forked from zakkak/turnin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ dep/ | |
obj/ | ||
*.o | ||
*.d | ||
*~ | ||
*~ | ||
*.swp | ||
*.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
CHANGELOG: | ||
|
||
2014-10-07 Antonios A. Chariton <[email protected]> | ||
- Added verify-turnin to verify a turnin | ||
- Renamed the scripts for extraction | ||
- Release v2.3 | ||
|
||
2014-09-27 Foivos S. Zakkak <[email protected]> | ||
- Change the directory structure of the project (getting ready to slice | ||
turnin.c) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/usr/bin/python | ||
|
||
########################################################################## | ||
# The MIT License (MIT) # | ||
# # | ||
# Copyright (c) 2014 Antonios A. Chariton <[email protected]> # | ||
# # | ||
# Permission is hereby granted, free of charge, to any person obtaining # | ||
# a copy of this software and associated documentation files (the # | ||
# "Software"), to deal in the Software without restriction, including # | ||
# without limitation the rights to use, copy, modify, merge, publish, # | ||
# distribute, sublicense, and/or sell copies of the Software, and to # | ||
# permit persons to whom the Software is furnished to do so, subject to # | ||
# the following conditions: # | ||
# # | ||
# The above copyright notice and this permission notice shall be # | ||
# included in all copies or substantial portions of the Software. # | ||
# # | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # | ||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # | ||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # | ||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # | ||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # | ||
########################################################################## | ||
|
||
########################################################################## | ||
# # | ||
# Verifies if the current user has successfully turned in an # | ||
# assignment for assignment in class. # | ||
# # | ||
########################################################################## | ||
|
||
import sys,os | ||
|
||
ver = "1.0" | ||
|
||
def usage(): | ||
print (" verify-turnin v" + ver) | ||
print " Usage: " | ||
print " verify-turnin assignment@course " | ||
print " \tVerify the turnin has been successful " | ||
print " verify-turnin -V " | ||
print " \tShow Copyright and Version information " | ||
|
||
def versionstuff(): | ||
print (" verify-turnin v" + ver) | ||
print " Copyright: " | ||
print " Copyright (c) 2014 \tAntonios A. Chariton \t<[email protected]> " | ||
print " License: " | ||
print " The current file is under the MIT License. " | ||
print " You can obtain a copy of the license here: <http://opensource.org/licenses/MIT> " | ||
print " Development: " | ||
print " Source Code available on GitHub: <https://github.com/zakkak/turnin> " | ||
|
||
def isDir(path): | ||
return (os.path.exists(path) and os.path.isdir(path)) | ||
|
||
if(len(sys.argv) != 2): # On improper calls, return usage information | ||
usage() | ||
exit(1) # Improper Call | ||
|
||
if(sys.argv[1] == "-V" or sys.argv[1] == "-v"): # Handle version and copyright | ||
versionstuff() | ||
exit(0) | ||
|
||
if(not("@" in sys.argv[1])): # Check if the argument supplied is indeed "properly" formatted | ||
usage() | ||
exit(1) | ||
|
||
argz = sys.argv[1].split("@") # Split the argument supplied by using @ as a delimiter | ||
assignment = argz[0] # The first field is the assignment | ||
course = argz[1] # The second field is the course | ||
# For the others we don't *really* care that much :P | ||
|
||
classDir = os.path.expanduser("~" + course) | ||
|
||
if (not(isDir(classDir))): # Check if the user has a home directory | ||
print " Could not find specified course " | ||
exit(2) # Could not find course | ||
if (not(isDir(classDir + "/TURNIN/" + assignment))): # Check if the assignment exists | ||
print " Could not find assignment directory " | ||
exit(3) # Could not find assignment | ||
|
||
grep = os.system("ls '" + classDir + "/TURNIN/" + assignment + "' | grep `whoami` | grep -v '#' > /dev/null 2> /dev/null") | ||
if( grep == 0 ): | ||
print (" You have successfully turned in " + assignment + " for " + course + " ") | ||
else: | ||
grep = os.system("ls '" + classDir + "/TURNIN/" + assignment + "' | grep `whoami` > /dev/null 2> /dev/null") | ||
if ( grep == 0 ): | ||
print (" You have attempted to turn in " + assignment + " for " + course + " but it is not valid.") | ||
else: | ||
print (" You have not turned in " + assignment + " for " + course + "! ") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters