Example #1
0
def list(request):
    response, parameters = validate_request(request)

    if response.status_code == 204:
        lista_img = manager.list(parameters['address'], parameters['name'])
        if len(lista_img) > 0:
            response = HttpResponse(simplejson.dumps({'images': lista_img}), mimetype='application/json')
            response.encoding = 'utf-8'
            response.status_code = 200
    return response
Example #2
0
def list(request):
    response, parameters = validate_request(request)

    if response.status_code == 204:
        lista_img = manager.list(parameters['address'], parameters['name'])
        if len(lista_img) > 0:
            response = HttpResponse(simplejson.dumps({'images': lista_img}),
                                    mimetype='application/json')
            response.encoding = 'utf-8'
            response.status_code = 200
    return response
def list(request):
    '''
    calls the methods of the package manager (several images in the folder list)
    and returns List Names Images to the end of the process.
    '''
    response, parameters = validate_request(request)

    if response.status_code == 204:
        lista_img = manager.list(parameters['address'], parameters['name'])
        if len(lista_img) > 0:
            response = HttpResponse(simplejson.dumps({'images': lista_img}), mimetype='application/json')
            response.encoding = 'utf-8'
            response.status_code = 200
    return response
Example #4
0
	def __init__(self, arguments):

		self.__version__ = "0.3.2"
		self.__doc__ = (Fore.MAGENTA + 'Wakanda Package Manager' + Style.RESET_ALL)+'\n'
		self.__doc__ += (Fore.GREEN + 'version '+self.__version__ + Style.RESET_ALL)+'\n'
		self.__doc__ += 'A package management tool\nRun "python wpm --help" for a list of commands.'

		self.__help__ = (Fore.RED + 'All the commands should be run in the directory where you want to manage packages!' + Style.RESET_ALL)+'\n'
		self.__help__ += 'Usage:\n'
		self.__help__ += 'python wpm [options] [arguments]\n\n'
		self.__help__ += 'Options:\n'
		self.__help__ += '   -h, --help        	  	print this command list\n'
		self.__help__ += '   -v, --version        	print version\n'
		self.__help__ += '   list     			list all packages installed in the directory\n'	
		self.__help__ += '   list --all        	        list all packages available on the addons repository\n'	
		self.__help__ += '   install [package,..]        	installs one or more packages\n'
		self.__help__ += '   remove [package,..]        	removes one or more packages\n'
		self.__help__ += '   update [package,..]        	updates one or more packages\n'
		self.__help__ += '   update        	        updates all packages\n'
		self.__help__ += '   update --self        	updates the WPM\n'
		self.__help__ += '   purge        	        purge all packages\n'	
		self.__help__ += '\n'+(Fore.YELLOW + 'WARNING: WPM is experimental. Version checks are lazy and manual modifications on extensions/widgets are ignored.' + Style.RESET_ALL)+'\n'



		self.arguments = arguments

		# script
		if len(self.arguments) < 2:
			print self.__doc__
			return None

		if len(self.arguments) < 3:
			if self.arguments[1] == 'install' or self.arguments[1] == 'remove' :
				print (Fore.YELLOW + 'YELLOW: NO PACKAGES SPECIFIED!' + Style.RESET_ALL) +' add at least one package name.'
				return None

		self.agvs = []

		for (i,argv) in enumerate(arguments):
			if i > 1:
				self.agvs.append(argv)

		self.command = arguments[1]
		if self.command == 'install':
			install(self.agvs)
		elif self.command == 'remove': 
			remove(self.agvs,None)
		elif self.command == 'update':
			update(self.agvs)
		elif self.command == 'purge':
			print (Fore.YELLOW + 'WARNING!' + Style.RESET_ALL)+' this will remove all the installed packages in this folder! Continue? [y/n]'
			choice = raw_input().lower()
			if choice in ['yes','y', 'ye', '']:
			   purge()
			elif choice in ['no','n']:
			   return None
			else:
			   sys.stdout.write((Fore.RED + 'UNVALID!' + Style.RESET_ALL)+" please respond with 'yes' or 'no'\n")
			   return None

		elif self.command == 'list':
			list(self.agvs)
		elif self.command == '-h' or self.command == '--help':
			print self.__help__
		elif self.command == '-v' or self.command == '--version':
			print 'v'+self.__version__
		else:
			print (Fore.RED + 'COMMAND NOT IMPLEMENTED YET!' + Style.RESET_ALL)
			return None
Example #5
0
from multiprocessing import Process
import manager


def f(d, l):
    d[1] = '1'
    d['2'] = 5
    d[0.25] = None
    l.reverse()
    print(d)
    print(l)


if __name__ == "__main__":
    manager = Manager()
    d = manager.dict()
    l = manager.list(range(10))
    p = Process(target=f, args=(d, l))
    p = start()
    p.join()
    d[1] = '1'
    d['2'] = 5
    d[0.25] = 4
    print(d)
    print(l)