markup: move functionality to library
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def pdf_rect(rect, container_height):
|
||||
x1 = min(rect[0], rect[2])
|
||||
y1 = max(rect[1], rect[3])
|
||||
@ -64,3 +68,15 @@ class Rect(object):
|
||||
|
||||
def __repr__(self):
|
||||
return 'Rect[l={}, t={}, r={}, b={}]'.format(int(self.left), int(self.top), int(self.right), int(self.bottom))
|
||||
|
||||
|
||||
def ensure_dir(dir):
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
os.chmod(dir, 0o775)
|
||||
shutil.chown(dir, group='procat')
|
||||
|
||||
|
||||
def set_file_perms(file):
|
||||
os.chmod(file, 0o664)
|
||||
shutil.chown(file, group='procat')
|
||||
|
||||
Reference in New Issue
Block a user