예제 #1
0
def build_component(bcomponent,install):
    paths = WS.find_component_src(bcomponent)
    if not paths:
        print("No such component exists")
        return False
    path = paths[0]
    srcpath = WS.find_workspace(path) + '/src'
    
    #ignore other components
    ignored_comps=[]
    for component in os.listdir(srcpath):
        if bcomponent == component or os.path.isdir(os.path.join(srcpath, component))==False or os.path.exists(os.path.join(srcpath,component,'IGNORE_COMP'))  :
            continue
        ignored_comps.append(component)
        os.system("touch " + os.path.join(srcpath,component,'IGNORE_COMP') )
    
    #build
    os.chdir(srcpath)
    os.chdir("../build")
    if install != 'notgiven' and install:
        os.system("cmake ../src -DRC_COMPONENT_INSTALL_PATH='"+str(os.path.abspath(install)) + "'")
    else:
        os.system('cmake ../src')

    if install == 'notgiven':
        os.system('make')
    elif install == None:
        os.system("sudo make install")
    else:
        os.system("make install ")
    
    #unignore other components
    for comp in ignored_comps:
        os.system("rm -f " + os.path.join(srcpath,comp,'IGNORE_COMP'))
예제 #2
0
def main():
    parser = argparse.ArgumentParser(description="configures and build components ")
    group = parser.add_mutually_exclusive_group()
    parser.add_argument('component', nargs='?', help='name of the component to build, if omitted curent workspace is build').completer = complete_components
    group.add_argument('-i','--install',nargs='?' , default = 'notgiven' , help="install the component(s) to given path(relative from build space or abs), defaults to /opt/robocomp")
    group.add_argument('--doc', action = 'store_true' , help="generate documentation")
    group.add_argument('--installdoc', action = 'store_true' , help="install documentation")
    
    argcomplete.autocomplete(parser)
    args = parser.parse_args()

    if not args.component:
        cpath = os.path.abspath('.')
        wspath = WS.find_workspace(cpath) #see if path consisits of an workspace 
        
        if wspath:
            #if we are inside a workspace
            
            rest = cpath[len(wspath):].split('/')
            if len(rest) >= 3 and rest[1] =='src' :
                #if we are inside a component source directory
                if args.doc or args.installdoc:
                    build_docs(rest[2],args.installdoc)
                else:
                    build_component(rest[2],args.install)
            else:
                os.chdir(wspath+"/build")
                
                if args.install != 'notgiven' and args.install:
                    os.system("cmake ../src -DRC_COMPONENT_INSTALL_PATH='"+str(os.path.abspath(args.install)) + "'")
                else:
                    os.system('cmake ../src')

                if args.installdoc or args.doc:
                    print("\nDocs can oly be generated for one component at a time")
                else:
                    if args.install == 'notgiven':
                        os.system('make')
                    elif args.install == None:
                        os.system("sudo make install")
                    else:
                        os.system("make install ")
        else:
            parser.error("This is not a valid robocomp workspace")
    
    else:
        component = args.component
        if args.doc or args.installdoc:
            build_docs(component,args.installdoc)
        else:
            build_component(component,args.install)
예제 #3
0
def build_component(bcomponent, install):
    paths = WS.find_component_src(bcomponent)
    if not paths:
        print("No such component exists")
        return False
    path = paths[0]
    srcpath = WS.find_workspace(path) + '/src'

    #ignore other components
    ignored_comps = []
    for component in os.listdir(srcpath):
        if bcomponent == component or os.path.isdir(
                os.path.join(srcpath, component)) == False or os.path.exists(
                    os.path.join(srcpath, component, 'IGNORE_COMP')):
            continue
        ignored_comps.append(component)
        os.system("touch " + os.path.join(srcpath, component, 'IGNORE_COMP'))

    #build
    os.chdir(srcpath)
    os.chdir("../build")
    if install != 'notgiven' and install:
        os.system("cmake ../src -DRC_COMPONENT_INSTALL_PATH='" +
                  str(os.path.abspath(install)) + "'")
    else:
        os.system('cmake ../src')

    if install == 'notgiven':
        os.system('make')
    elif install == None:
        os.system("sudo make install")
    else:
        os.system("make install ")

    #unignore other components
    for comp in ignored_comps:
        os.system("rm -f " + os.path.join(srcpath, comp, 'IGNORE_COMP'))
예제 #4
0
def main():
    parser = argparse.ArgumentParser(
        description="configures and build components ")
    group = parser.add_mutually_exclusive_group()
    parser.add_argument(
        'component',
        nargs='?',
        help=
        'name of the component to build, if omitted curent workspace is build'
    ).completer = complete_components
    group.add_argument(
        '-i',
        '--install',
        nargs='?',
        default='notgiven',
        help=
        "install the component(s) to given path(relative from build space or abs), defaults to /opt/robocomp"
    )
    group.add_argument('--doc',
                       action='store_true',
                       help="generate documentation")
    group.add_argument('--installdoc',
                       action='store_true',
                       help="install documentation")

    argcomplete.autocomplete(parser)
    args = parser.parse_args()

    if not args.component:
        cpath = os.path.abspath('.')
        wspath = WS.find_workspace(
            cpath)  #see if path consisits of an workspace

        if wspath:
            #if we are inside a workspace

            rest = cpath[len(wspath):].split('/')
            if len(rest) >= 3 and rest[1] == 'src':
                #if we are inside a component source directory
                if args.doc or args.installdoc:
                    build_docs(rest[2], args.installdoc)
                else:
                    build_component(rest[2], args.install)
            else:
                os.chdir(wspath + "/build")

                if args.install != 'notgiven' and args.install:
                    os.system("cmake ../src -DRC_COMPONENT_INSTALL_PATH='" +
                              str(os.path.abspath(args.install)) + "'")
                else:
                    os.system('cmake ../src')

                if args.installdoc or args.doc:
                    print(
                        "\nDocs can oly be generated for one component at a time"
                    )
                else:
                    if args.install == 'notgiven':
                        os.system('make')
                    elif args.install == None:
                        os.system("sudo make install")
                    else:
                        os.system("make install ")
        else:
            parser.error("This is not a valid robocomp workspace")

    else:
        component = args.component
        if args.doc or args.installdoc:
            build_docs(component, args.installdoc)
        else:
            build_component(component, args.install)