Ejemplo n.º 1
0
def file_make(path):
    os.chdir(path)
    try:
        print "Begin make and make install on the path %s" % path
        os_cmd('make && make install')
    except OSError as e:
        print "Something wrong during make the soft"
        print >>sys.stderr, "Execution Failed!", e
Ejemplo n.º 2
0
def file_config(path, prefix, *options):
    '''
    It configure the soft in general way :
        ./configure --prefix='prefix' 'options'
    or  ./config --prefix='prefix' 'options'
    or  -cmake -DCMAKE_INSTALL_PREFIX='prefix' 'options' on the 'path'
    The options can be strings like '--some-option=xxx --some-option=xxx'
    or  can be the args like '--some-option=xxx','-some-options=xxx'
    '''
    config_cmd = ['./configure', './config']
    # del the ' ' in the options
    options = ' '.join(options)
    if os.path.exists(os.path.join(path, config_cmd[0].strip('./'))): 
        con_list = [config_cmd[0] , '--prefix=%s' % prefix, options]
        con = ' '.join(con_list)
        os.chdir(path)
        os_cmd(con)
    elif os.path.exists(os.path.join(path, config_cmd[1].strip('./'))):
        con_list = [config_cmd[1], '--prefix=%s' % prefix, options]
        con = ' '.join(con_list)
        os.chdir(path)
        os_cmd(con)
    else:
        cmake_cmd = '/opt/lnmp/app/init/bin/cmake'
        if os.path.exists(cmake_cmd):
            con_list = [cmake_cmd, '-DCMAKE_INSTALL_PREFIX=%s' % prefix, options]
            con = ' '.join(con_list)
            os.chdir(path)
            os_cmd(con)
        else:
            print "You need to install cmake !"
Ejemplo n.º 3
0
	def apt_install(self, soft):
		''' It will install soft with apt command on the ubuntu '''
		try:
			print 'I will begin to install %s on the system !' % soft
			os_cmd('apt-get install -y %s' % soft)
			print 'The install operation complete !'
			os_cmd('apt-get -fy install')
			os_cmd('apt-get -y autoremove')
		except OSError as e :
			print >>sys.stderr, "Execution Falied: ", e
Ejemplo n.º 4
0
	def apt_update(self):
		''' Executed the 'apt-get update' 
						 'apt-get upgrade -y' on the ubuntu system '''
		os_cmd('apt-get update')
		os_cmd('apt-get -y upgrade')