import errno
import pathlib
import platform
import sys
import subprocess


def main():
    dist = platform.dist()
    if dist[0] != 'debian' and dist[0] != 'Ubuntu':
        print('This script can only be run on Debian GNU/Linux or Ubuntu.')
        sys.exit(errno.EPERM)

    workdir = pathlib.Path(__file__).resolve().parent.parent

    subprocess.check_call(
        [
            'cp'
        ] +
        [str(path) for path in ((workdir / 'scripts').glob('*'))] +
        [
            str(workdir / 'deploy' / 'tmp' / 'scripts')
        ]
    )


if __name__ == '__main__':
    main()

import errno
import pathlib
import platform
import sys
import subprocess


def main():
    dist = platform.dist()
    if dist[0] != 'debian' and dist[0] != 'Ubuntu':
        print('This script can only be run on Debian GNU/Linux or Ubuntu.')
        sys.exit(errno.EPERM)

    workdir = pathlib.Path(__file__).resolve().parent.parent
    with (workdir / 'etc' / 'revision.txt').open('r') as revision_file:
        revision = (revision_file.readline().strip())
    venv_dir = pathlib.Path('/home/cliche/venv_{}'.format(revision))

    subprocess.check_call(
        [
            'sudo',
            '-ucliche',
            str(venv_dir / 'bin' / 'pip'),
            'install',
            'uwsgi',
        ]
    )


if __name__ == '__main__':
    main()

Install uwsgi in venv on web upgrade
Install uwsgi in venv on web upgrade

  import errno
  import pathlib
  import platform
  import sys
  import subprocess
  
  
  def main():
      dist = platform.dist()
      if dist[0] != 'debian' and dist[0] != 'Ubuntu':
          print('This script can only be run on Debian GNU/Linux or Ubuntu.')
          sys.exit(errno.EPERM)
  
      workdir = pathlib.Path(__file__).resolve().parent.parent
+     with (workdir / 'etc' / 'revision.txt').open('r') as revision_file:
+         revision = (revision_file.readline().strip())
+     venv_dir = pathlib.Path('/home/cliche/venv_{}'.format(revision))
  
      subprocess.check_call(
          [
-             'cp'
+             'sudo',
-         ] +
-         [str(path) for path in ((workdir / 'scripts').glob('*'))] +
-         [
-             str(workdir / 'deploy' / 'tmp' / 'scripts')
+             '-ucliche',
+             str(venv_dir / 'bin' / 'pip'),
+             'install',
+             'uwsgi',
          ]
      )
  
  
  if __name__ == '__main__':
      main()
  
Install uwsgi in venv on web upgrade
## Code Before:
import errno
import pathlib
import platform
import sys
import subprocess


def main():
    dist = platform.dist()
    if dist[0] != 'debian' and dist[0] != 'Ubuntu':
        print('This script can only be run on Debian GNU/Linux or Ubuntu.')
        sys.exit(errno.EPERM)

    workdir = pathlib.Path(__file__).resolve().parent.parent

    subprocess.check_call(
        [
            'cp'
        ] +
        [str(path) for path in ((workdir / 'scripts').glob('*'))] +
        [
            str(workdir / 'deploy' / 'tmp' / 'scripts')
        ]
    )


if __name__ == '__main__':
    main()

## Instruction:
Install uwsgi in venv on web upgrade
## Code After:
import errno
import pathlib
import platform
import sys
import subprocess


def main():
    dist = platform.dist()
    if dist[0] != 'debian' and dist[0] != 'Ubuntu':
        print('This script can only be run on Debian GNU/Linux or Ubuntu.')
        sys.exit(errno.EPERM)

    workdir = pathlib.Path(__file__).resolve().parent.parent
    with (workdir / 'etc' / 'revision.txt').open('r') as revision_file:
        revision = (revision_file.readline().strip())
    venv_dir = pathlib.Path('/home/cliche/venv_{}'.format(revision))

    subprocess.check_call(
        [
            'sudo',
            '-ucliche',
            str(venv_dir / 'bin' / 'pip'),
            'install',
            'uwsgi',
        ]
    )


if __name__ == '__main__':
    main()
