diff --git a/0.1.11 b/0.1.11 new file mode 100644 index 0000000000000000000000000000000000000000..b5f99d0ce8e8c3b214d0a7d4e7a694490eeffed9 --- /dev/null +++ b/0.1.11 @@ -0,0 +1,10 @@ +Requirement already satisfied: codesnipper in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (0.1.11) +Requirement already satisfied: wexpect in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from codesnipper) (4.0.0) +Requirement already satisfied: pybtex in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from codesnipper) (0.24.0) +Requirement already satisfied: pexpect in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from codesnipper) (4.8.0) +Requirement already satisfied: ptyprocess>=0.5 in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from pexpect->codesnipper) (0.7.0) +Requirement already satisfied: six in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from pybtex->codesnipper) (1.16.0) +Requirement already satisfied: latexcodec>=1.0.4 in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from pybtex->codesnipper) (2.0.1) +Requirement already satisfied: PyYAML>=3.01 in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from pybtex->codesnipper) (6.0) +Requirement already satisfied: pywin32>=220 in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from wexpect->codesnipper) (304) +Requirement already satisfied: psutil>=5.0.0 in c:\users\tuhe\appdata\local\programs\python\python310\lib\site-packages (from wexpect->codesnipper) (5.9.1) diff --git a/setup.py b/setup.py index aa492a27d7177c34b89d0d031013fa036a9aa6b2..a70db3c39517e87876654afb3cbc35429c33945a 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,10 @@ import setuptools import pkg_resources + with open("src/snipper/version.py", "r", encoding="utf-8") as fh: __version__ = fh.read().split(" = ")[1].strip()[1:-1] - with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() diff --git a/src/codesnipper.egg-info/PKG-INFO b/src/codesnipper.egg-info/PKG-INFO index f95b07cf7df87424af270c862bf798e7b9b9673d..1415e4f4a4163f11e0dfb7633e48481046a139e1 100644 --- a/src/codesnipper.egg-info/PKG-INFO +++ b/src/codesnipper.egg-info/PKG-INFO @@ -1,13 +1,12 @@ Metadata-Version: 2.1 Name: codesnipper -Version: 0.1.7 +Version: 0.1.11 Summary: A lightweight framework for censoring student solutions files and extracting code + output Home-page: https://lab.compute.dtu.dk/tuhe/snipper Author: Tue Herlau Author-email: tuhe@dtu.dk License: MIT Project-URL: Bug Tracker, https://lab.compute.dtu.dk/tuhe/snipper/issues -Platform: UNKNOWN Classifier: Programming Language :: Python :: 3 Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent @@ -405,4 +404,3 @@ raise NotImplementedError('Complete the above program') year={2021}, } ``` - diff --git a/src/codesnipper.egg-info/SOURCES.txt b/src/codesnipper.egg-info/SOURCES.txt index 31883456cf9554c60cbb0d0d6e049b6a3b7965a6..20caaa7c6100d5a277ec55dc783052e6421bd95f 100644 --- a/src/codesnipper.egg-info/SOURCES.txt +++ b/src/codesnipper.egg-info/SOURCES.txt @@ -20,4 +20,5 @@ src/snipper/legacy.py src/snipper/load_citations.py src/snipper/snip_dir.py src/snipper/snipper_main.py +src/snipper/test.py src/snipper/version.py \ No newline at end of file diff --git a/src/snipper/load_citations.py b/src/snipper/load_citations.py index 0512cd1b00a0c662d2f6188f457cd97db9c9901a..f645b0a4c32184d93283ecf1e1ed29e7cfd51d12 100644 --- a/src/snipper/load_citations.py +++ b/src/snipper/load_citations.py @@ -1,5 +1,6 @@ import os import io +import glob from pybtex import plugin from pybtex.database.input import bibtex from warnings import warn @@ -8,10 +9,30 @@ from warnings import warn def get_aux(auxfile): # paths = get_paths() # auxfile = os.path.join(paths['02450public'], auxfile) + auxfile = os.path.normpath(auxfile) # Unsure if this is required. But had problems finding the auxfile on git. + auxfile = auxfile.replace(os.sep, '/') + if not os.path.exists(auxfile): # print(auxfile) + warn("Could not find bibtex file: " + auxfile + " testing for troubles") + auxdir = os.path.dirname(auxfile) + # os.path.curdir + + print("The current working directory (os.getcwd()) is ", os.getcwd() ) + try: + print("Trying to list files in builds dir") + for f in glob.glob("/builds/02465material/*"): + print(f) + except Exception as e: + print(e) + + if not os.path.dirname(auxdir): + print("Directory for auxfile does not exist:", auxdir) + else: + print("Auxfile did not exist, but directory did. Printing the contents:") + for f in glob.glob(os.path.dirname(auxfile) + "/*"): + print(f) - warn("Could not find bibtex file: "+ auxfile) return {} with open(auxfile, 'r') as f: diff --git a/src/snipper/snip_dir.py b/src/snipper/snip_dir.py index ba98cd7ccf8785c0a07e8a0b2f86715e722932c7..431ab41c29f0302d3f0b14729d4c5ff322a3e326 100644 --- a/src/snipper/snip_dir.py +++ b/src/snipper/snip_dir.py @@ -1,12 +1,13 @@ -import os, shutil +import os +import shutil from snipper.snipper_main import censor_file from pathlib import Path import time import fnmatch import tempfile -from line_profiler_pycharm import profile +# from line_profiler_pycharm import profile -@profile +# @profile def snip_dir(source_dir, # Sources dest_dir=None, # Will write to this directory output_dir=None, # Where snippets are going to be stored @@ -16,10 +17,10 @@ def snip_dir(source_dir, # Sources cut_files=True, # censor files. license_head=None, censor_files=True, + verbose=True, ): print("Snipper fixing", source_dir) - if dest_dir == None: dest_dir = tempfile.mkdtemp() print("[snipper]", "no destination dir was specified so using nonsense destination:", dest_dir) @@ -49,8 +50,8 @@ def snip_dir(source_dir, # Sources os.makedirs(dest_dir) out = dest_dir hw = {'base': source_dir} - - print(f"[snipper]: {hw['base']} -> {out}") + if verbose: + print(f"[snipper]: {hw['base']} -> {out}") if os.path.exists(dest_dir): shutil.rmtree(dest_dir) @@ -72,7 +73,8 @@ def snip_dir(source_dir, # Sources if accept: solution_list = [] kwargs = {} - print("Snipper processing", f) + if verbose: + print("Snipper processing", f) nrem, cut = censor_file(f, run_files=run_files, run_out_dirs=output_dir, cut_files=cut_files, # solution_list=solution_list, base_path=dest_dir, @@ -80,11 +82,11 @@ def snip_dir(source_dir, # Sources license_head=license_head, censor_files=censor_files, **kwargs) - if nrem > 0: + if nrem > 0 and verbose: print(f"{nrem}> {f}") cutouts[str(f)] = cut n += nrem - # print("[snipper]", "removing") + for rm_file, accept in acceptable: rm_file = os.path.abspath(rm_file) if not accept: diff --git a/src/snipper/snipper_main.py b/src/snipper/snipper_main.py index 9e02bfcc9ea405d14ab72fc6fe45642ea7c4f545..1fab5ebd3f8b52bd77ed6063c6715a7334782f82 100644 --- a/src/snipper/snipper_main.py +++ b/src/snipper/snipper_main.py @@ -71,8 +71,8 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True, if censor_files: lines = fix_f(lines, dbug) - if "pacman" in str(file): - print("sdaf") + # if "pacman" in str(file): + # print("sdaf") lines, nB, cut = fix_b(lines) else: nB = 0 diff --git a/src/snipper/version.py b/src/snipper/version.py index 283b03a075bdc493860ebb799f4b2f3ee2a72d87..6dbb672ffb8889efcd413672815cdfb59af8a81a 100644 --- a/src/snipper/version.py +++ b/src/snipper/version.py @@ -1 +1,4 @@ -__version__ = "0.1.7" \ No newline at end of file +__version__ = "0.1.12" + +# /builds/02465material/02465public +# /builds/02465material/02465public \ No newline at end of file