File: install.py

package info (click to toggle)
pymecavideo 6.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,996 kB
  • sloc: python: 4,604; xml: 881; makefile: 134
file content (39 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
##installation script-
from __future__ import print_function

import subprocess
import os

os.chdir("src")
cmd2 = subprocess.Popen(["make"], stdout=subprocess.PIPE)
cmd2.poll()
cmd2.wait()
os.chdir("..")
if os.getuid() == 0:
    cmd2 = subprocess.Popen(["python", "setup.py", "install"], stdout=subprocess.PIPE)
    cmd2.poll()
    cmd2.wait()
    output = cmd2.stdout.readlines()
    for ligne in output:
        if "site-packages" in ligne:
            liste = ligne.split()
            for i in liste:
                if "site-packages" in i:
                    chemin_l = os.path.split(i)
                    for j in chemin_l:
                        if "site-packages" in j:
                            install_dir = j
                            print ("pymecavideo installé à", install_dir)
    if install_dir:
        print ("OK")
        cmd3 = subprocess.Popen(["cp", "-Rp", "data", os.path.join(install_dir, "pymecavideo")], stdout=subprocess.PIPE)
        cmd3.poll()
        cmd3.wait()
        print (cmd3.stdout.readlines())
        cmd4 = subprocess.Popen(["chmod", "755", os.path.join(install_dir, "pymecavideo/data")], stdout=subprocess.PIPE)
        cmd4.poll()
        cmd4.wait()
        print (cmd4.stdout.readlines())
else:
    print ("ERREUR, veuillez lancer ce script avec des droits supérieurs (sudo ou logguez vous en root")