20 lines
584 B
Python
20 lines
584 B
Python
# -*- coding: utf-8 -*-
|
|
import sysconfig
|
|
import os
|
|
import subprocess
|
|
|
|
lib_path = sysconfig.get_paths()['purelib']
|
|
|
|
if not lib_path:
|
|
raise Exception("python lib like site-packages not found!")
|
|
|
|
current_path = os.path.abspath('.')
|
|
|
|
cmd = "ln -s {0} {1}/ops".format(current_path, lib_path)
|
|
cmdref = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
shell=True)
|
|
output, error_info = cmdref.communicate()
|
|
if cmdref.returncode != 0:
|
|
error_msg = "run cmd {0} failed,error was {1}".format(cmd, error_info)
|
|
raise Exception(error_msg)
|