ya2 · news · projects · code · about

removed pdfsingle
authorFlavio Calva <f.calva@gmail.com>
Mon, 20 Jun 2022 17:28:12 +0000 (18:28 +0100)
committerFlavio Calva <f.calva@gmail.com>
Mon, 20 Jun 2022 17:28:12 +0000 (18:28 +0100)
ya2/tools/pdfsingle.py [deleted file]

diff --git a/ya2/tools/pdfsingle.py b/ya2/tools/pdfsingle.py
deleted file mode 100755 (executable)
index 6d76361..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# python ya2/tools/pdfsingle.py path/to/file.py
-from os import chdir, getcwd, system
-from os.path import dirname, basename, exists
-from sys import argv
-
-
-class InsideDir:
-
-    def __init__(self, dir_):
-        self.dir = dir_
-        self.old_dir = getcwd()
-
-    def __enter__(self):
-        chdir(self.dir)
-
-    def __exit__(self, exc_type, exc_val, exc_tb):
-        chdir(self.old_dir)
-
-
-filename = argv[1]
-name = basename(filename)
-path = dirname(filename)
-noext = name.rsplit('.', 1)[0]
-test_tmpl = "tail -n +1 {found} " + \
-    "| sed 's/==> /# ==> /' > tmp.txt ; enscript --font=Courier10 " + \
-    "--continuous-page-numbers --no-header --pretty-print=python " + \
-    "-o - tmp.txt | psnup -2 -P letter -p a4 -m12 | ps2pdf - {name}.pdf ; rm tmp.txt"
-    #"-o - tmp.txt | ps2pdf - {name}.pdf ; rm tmp.txt"
-found = filename
-with InsideDir('tests/' + path):
-    if exists('test_' + name):
-        found += ' ya2/tests/%s/test_%s' % (path, name)
-test_cmd = test_tmpl.format(name=noext, found=found)
-system(test_cmd)
-#system('pdfnup --nup 2x1 -o {noext}.pdf {noext}.pdf'.format(noext=noext))