All pastes #125862 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-08-10 23:56 UTC
rendered paste body
#!/usr/bin/env python

############################################
## Application: Ubuntu Easy Compiler(UEC) ##
## Version: .01 Beta Alpha Omega          ##
## Creator: Christopher Woodall (Note360) ##
## Date: Aug 9, 2006                      ##
## Copyright: GPL                         ##
############################################

# Requires build-essentials and checkinstall
# I imported os so I can use os.popen
import os

# Make into a module eventually

# For Help
def help(argument=None):
	"""help - This command is ment for help options eventually I intend to
	make a shellish thing for this (advanced mode)"""
	if argument == None:
		print "I need a argument to help you."

	# Help for changing directories to the proper directory
	elif argument == 'cd':
		print "This is the help for changing directories."
		print "For this option just input the directory that the configure and make files are in"
		print "ex) /home/user_name/Desktop/joe_application"

	# Help for choosing a installation option
	elif argument == 'install':
		print "This is the help for installation."
		print "All I need is a option to run. Currently I take checkinstall and make install (make)"
		print "I suggest checkinstall because that will creat a .deb for you."


def configure(argument=None):
	"""To configure a file"""
	if argument == None:
		os.popen('./configure')
	else:
		str(argument)
		config = "./configure %d" % (argument)
		os.popen( config)

# To make a program
def make(argument=None):
	"""To make a program and install a program"""
	if argument == None:
		os.popen('make')
	# To install a program
	elif argument == 'install':
		str(argument)
		os.popen('sudo make install')
	else:
		str(argument)
		make_arg = "sudo make %d" % (argument)	# sudo just incase
		os.popen(make_arg)

# To install and make a .deb
def checkinstall(argument='-y'):
	"""To install a program and make a .deb 
	(or rpm if given the proper arguments"""
	if argument == None:
   		os.popen('sudo checkinstall')
	elif argument == '-y':
		os.popen('sudo checkinstall -y')
	else:
		str(argument)
		check_arg = "sudo checkinstall %d" % (argument)
		os.popen(check_arg)

def nLines(n=1):
	while n > 0:
		print
		n -= 1

# Program starts
print "Hello, This is the Ubuntu Easy Compiler."
print "This program is under the GPL and is written by Chris Woodall"
print "Requires build-essentials and checkinstall"
print "At any prompt answer help for help"

nLines(1)

n = 0
x = 0

while x == 0:
	MyDir = raw_input("What directory is the source in? ")
	str(MyDir)

	# help is the function that prints out help for the current topic
	if MyDir == "help":
		help('cd')
        	x = 0
	else:
		os.chdir(MyDir)
		x = 1 

nLines(1)

while n == 0:
	install = raw_input("How would you like to install?(default is checkinstall) ")
	str(install)
	
	if install == "help": # help is the function that prints out help for the current topic
		help('install')
		n = 0
	
	elif install == '':			# To set the default setting of install to checkinstall
		install = 'checkinstall'
		n = 1
	
	else: 
		n = 1

print "Configuring... "  # Just some prompts To signify where the program is
configure()
print "Done Configuring!\n" 

print "Making... "
make()
print "Done Making\n"

if install == 'checkinstall':
	print "Installing... "
	checkinstall()
	print "Done Installing!\n"

if install == 'make':
	print "Installing... "
	make('install')
	print "Done Installing!\n"

# Closing prompt
print "Thank you, for using UEC."