Skip to content
Snippets Groups Projects
Commit b35a65f6 authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

new utilis to set right permissions after sen2cor, executed durin L1cProduct.process_l2a

parent 15348fba
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ from pathlib import Path
# type annotations
from typing import List, Tuple, Optional
from .utils import grouper
from .utils import grouper, setPermissions
from .config import Config, SHARED_DATA
from .xmlparser import MetadataParser
from .sen2cor import process_sen2cor
......@@ -206,6 +206,7 @@ class L1cProduct(Product):
# the newly L2A must be moved to his L2A library folder.
if self._library_product:
l2a_prod.archive()
L2aProduct(l2a_identifier).setPermissions()
return self
# METADATA
......@@ -513,6 +514,8 @@ class L2aProduct(Product):
return self
def setPermissions(self):
setPermissions(self.path)
# def has_indice(self, indice):
# """
......
......@@ -563,8 +563,12 @@ class Tile:
outfullpath = l2a.path.parent / (p[39:44] + '_' + p[0:4] + p[11:19] + '_QL_latest.jpg')
old_ql = list(l2a.path.parent.glob('*_QL_latest.jpg*'))
for f in old_ql:
liste=[a for a in old_ql if str(outfullpath) not in str(a)]
for f in liste:
f.unlink()
l2a.process_ql(out_path = outfullpath, out_resolution=(750,750), jpg = True)
if outfullpath in old_ql:
logger.info("{} - Latest QL already done".format(self.name))
return
else:
l2a.process_ql(out_path = outfullpath, out_resolution=(750,750), jpg = True)
......@@ -89,4 +89,20 @@ def getFolderSize(folder, follow_symlinks = False):
except:
pass
return total_size
def setPermissions(path):
for dir_path, dir_names, files in os.walk(str(path)):
for d in dir_names:
name = dir_path + '/' + d
os.chmod(name, os.stat(name).st_mode | 0o075)
os.chmod(name, os.stat(name).st_mode & ~0o002)
for f in files:
name = dir_path + '/' + f
os.chmod(name, os.stat(name).st_mode | 0o064)
os.chmod(name, os.stat(name).st_mode & ~0o003)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment