Skip to content

Commit

Permalink
feat: jans-linux-setup copy site packages in case of pyz
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed Mar 17, 2022
1 parent e26e826 commit 8a8a05e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions jans-linux-setup/jans_setup/setup_app/installers/jans.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import re
import requests
import zipfile
import site

from pathlib import Path

Expand Down Expand Up @@ -468,3 +469,18 @@ def post_install_tasks(self):
cron_service = 'crond' if base.os_type in ['centos', 'red', 'fedora'] else 'cron'
self.restart(cron_service)


# if we are running inside shiv package, copy site pacakages to /opt/dist/jans-setup-packages and add to sys path

gluu_site_dir = '/opt/dist/jans-setup-packages'

for p in sys.path:
ps = str(p)
if '/.shiv/' in ps and ps.endswith('site-packages'):
if not gluu_site_dir in sys.path:
if not os.path.exists(site.USER_SITE):
os.makedirs(site.USER_SITE)
with open(os.path.join(site.USER_SITE, 'jans_setup_site.pth'), 'w') as site_file:
site_file.write(gluu_site_dir)
self.logIt("Copying site packages to {}".format(gluu_site_dir))
shutil.copytree(p, gluu_site_dir, dirs_exist_ok=True)

0 comments on commit 8a8a05e

Please sign in to comment.