2020-11-03

#coding=utf-8
import os
import shutil
from os import path
from subprocess import Popen, PIPE, STDOUT
import os
import subprocess

def execShellCommand(cmd):
    print  "================cmd================="
    print cmd
    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,executable="/bin/bash")
    while True:  
        buff = p.stdout.readline()  
        if buff == '' and p.poll() != None:  
            break
        print buff
    p.wait()


def copyFile(windowS_path, linuxS_path):
    print "========================="
    print "windowS_path: " + windowS_path
    print "linuxS_path: " + linuxS_path
    try:
        shutil.copy(windowS_path, linuxS_path)
    except IOError as e:
        print("Unable to copy file. %s" % e)
    except:
        print("Unexpected error:", sys.exc_info())
    
    
filename = 'barrierFree.txt' # txt文件和当前脚本在同一目录下,所以不用写具体路径
pos = []

preLinux = '/home/xaioming/workingSpace'
prewindow = '/home/xaioming/workingSpace/local/aosp_'



linuxS = []
windowS = []
with open(filename, 'r') as file_to_read:
    while True:
        lines = file_to_read.readlines() # 整行读取数据
        if not lines:
            break
            pass
        for i in lines:
            i = '/'.join(i.split('\\'))  # transform the windows path to linux path
            if (len(i)==0) or (len(i[0]) == 0) or i[0].strip()=='':
                continue
            
            i = i.strip().split('aosp_')
            print "==============="
            print i
            print i[0]
            print i[1]
        
            linuxS.append(preLinux + i[1])
            windowS.append(prewindow + i[1])
    
    print windowS
    print linuxS
    

    #execShellCommand("cp  $windowS_path  $linuxS_path")
    for i in range(len(windowS)):
        copyFile(windowS[i], linuxS[i])
        
 
def main():
    
    rootPath = "/home/xaioming/workingSpace/aosp/"
    os.chdir(rootPath)
    
    
    #execShellCommand("pwd")
    #execShellCommand("source build/envsetup.sh")
    # not work
    #execShellCommand("lunch aosp_sailfish-userdebug")
    #execShellCommand("make framework -j8")
    #execShellCommand("make services -j8")
    #execShellCommand("cp  /home/xaioming/workingSpace/aosp/out/target/product/sailfish/system/framework/framework.jar  /home/xaioming/workingSpace/local/python_install/jars ")
    #execShellCommand("cp  /home/xaioming/workingSpace/aosp/out/target/product/sailfish/system/framework/services.jar  /home/xaioming/workingSpace/local/python_install/jars ")

if __name__ == "__main__":
    main()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值