From: Flavio Calva Date: Mon, 20 Jun 2022 17:28:12 +0000 (+0100) Subject: removed pdfsingle X-Git-Url: http://git.ya2.it/?p=pmachines.git;a=commitdiff_plain;h=2555b0ea4e4849b70c9eef90e5c9d7c5f052b737;ds=sidebyside removed pdfsingle --- diff --git a/ya2/tools/pdfsingle.py b/ya2/tools/pdfsingle.py deleted file mode 100755 index 6d76361..0000000 --- a/ya2/tools/pdfsingle.py +++ /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))