update function pass variable

This commit is contained in:
Dimitris Zlatanidis 2015-02-09 11:49:59 +02:00
parent 6568b00566
commit a8756d09c9
2 changed files with 8 additions and 7 deletions

View file

@ -505,7 +505,7 @@ Build packages and passing variables to the script:
First export variable(s) like: First export variable(s) like:
$ export SLPKG_FFMPEG_ASS=yes SLPKG_FFMPEG_X264=yes $ export FFMPEG_ASS=yes FFMPEG_X264=yes
And then run as you know: And then run as you know:

View file

@ -104,14 +104,15 @@ class BuildPackage(object):
def _pass_variable(self): def _pass_variable(self):
''' '''
Grep slpkg bash variable Return enviroment variables
''' '''
pass_var = [] pass_var = []
bash_var = subprocess.check_output("set | grep 'SLPKG'", shell=True) for var in os.environ.keys():
for var in bash_var.splitlines(): if (var.startswith('{0}_'.format(self.prgnam.upper())) and
if (var.startswith('SLPKG_') and var.split('_')[-2] == self.prgnam.upper()):
var.split('_')[-2].lower() == self.prgnam.lower()): pass_var.append('{0}={1}'.format(
pass_var.append(var[len('SLPKG') + len(self.prgnam) + 2:]) var[len(self.prgnam.upper()) + 1:],
os.environ[var]))
return pass_var return pass_var