def _write_cluster_feed(self, cluster): feed_name = self._cluster_feed_name(cluster) subdirs = dict((self._src_dir_name(x),x) for x in cluster) interface = _.interface( uri=boost_feed_uri(feed_name) , xmlns='http://zero-install.sourceforge.net/2004/injector/interface' , **{ 'xmlns:compile':'http://zero-install.sourceforge.net/2006/namespaces/0compile' , 'xmlns:dc':'http://purl.org/dc/elements/1.1/' })[ _.name['%s (built state)' % ', '.join(cluster),] , _.summary['Evil Build Dependency Cluster (EBDC)'] , boost_icon , _.group(license=BSL_1_0) [ self._implementation('*-src')[self._empty_zipball] , _.command(name='compile') [ _.runner(interface=ryppl_feed_uri('ryppl')) [ _.arg[ '0install-cmake' ] , _.arg[ '--overlay=${BOOST_CMAKELISTS}' ] # , _.arg[ '--build-type=Debug' ] if component == 'dbg' else [] , [ _.arg[x] for d,c in subdirs.items() for x in ['--add-subdirectory', '${%s_SRCDIR}' % c, d ] ] # Component selection may be too naive here in # general, but hopefully this whole block will # be obsolete as we eliminate clusters , [ _.arg[ d+'/'+component ] for component in 'dev','bin' for d in subdirs ] ] , [ _.requires(interface=boost_feed_uri(d+'-src')) [ _.environment(insert='.', mode='replace', name=c+'_SRCDIR') ] for d,c in subdirs.items()] , _.requires(interface=boost_feed_uri('CMakeLists'))[ _.environment(insert='.', mode='replace', name='BOOST_CMAKELISTS') ] , self._dev_requirements( dep for x in cluster for dep in self._build_dependencies(x) if dep not in cluster ) ] ] ] interface.indent() feed_path = self.feed_dir/feed_name+'.xml' xml_document(interface).write(feed_path, encoding='utf-8', xml_declaration=True) sign_feed(feed_path)
def _write_feed(self, component, *contents): interface = self._interface(component)[ _.group(license=BSL_1_0) [ contents ] ] interface.indent() feed_path = self.feed_dir/self._feed_name(component) xml_document(interface).write(feed_path, encoding='utf-8', xml_declaration=True) sys.stdout.flush() sign_feed(feed_path)
def __init__(self, login, **kwargs): """Initializes the FedExSimpleRateCheck object with the Transaction ID/AccountNumber/MeterNumber combo as well as information on the source and destination of the package. A list of FedEx country codes can be found in the appendix of the FedEx Ship Manager API XML Transaction Guide.""" # Initialize Access Request FedExTools.__init__(self, login) # Total price for shipments self.total_cost = 0 self.service = kwargs.get('service','FEDEXGROUND') # Package Information, such as weight and packingtype, e.g. [(1.4,"FEDEXBOX"),...] self.package_info = [] # If we got the full country name, convert it to a country code kwargs['to_country'] = COUNTRIES.get(kwargs.get('to_country', None), kwargs.get('to_country', None)) # Build Request # <FDXRateRequest xmlns:...> request = _.FDXRateRequest( **{ 'xmlns:api':APIURL , 'xmlns:xsi':XSIURL ,'xsi:noNamespaceSchemaLocation':RATE_NNSLOC })[ self.request_header , _.Service[ self.service ] # FedEx Ground Home Delivery Packaging must be YOURPACKAGING only. , _.Packaging[ kwargs.get('packaging','YOURPACKAGING') ] , _.WeightUnits[ kwargs.get('weight_units','LBS') ] # Value will be overridden in getResponse() , _.Weight[ '' ] , _.OriginAddress[ _.StateOrProvinceCode[ kwargs.get('from_state','') ] , _.PostalCode[ kwargs.get('from_zip_code','') ] , _.CountryCode[ kwargs.get('from_country','US') ] ] , _.DestinationAddress[ _.StateOrProvinceCode[ kwargs.get('to_state','') ] , _.PostalCode[ kwargs.get('to_zip_code','') ] , _.CountryCode[ kwargs.get('to_country','US') ] ] , _.Payment , _.PackageCount[ 1 ] ] self.requestxml = xml_document(request)
def __init__(self, login, **kwargs): """Initializes self with the Transaction ID/AccountNumber/MeterNumber combo as well as information on the source and destination of the package. A list of FedEx country codes can be found in the appendix of the FedEx Ship Manager API XML Transaction Guide.""" # Initialize Access Request FedExTools.__init__(self, login, kwargs['carrier']) # Package Information, such as weight and packingtype, e.g. [(1.4,"FEDEXBOX"),...] self.package_info = [] # If we got the full country name, convert it to a country code kwargs['to_country'] = COUNTRIES.get(kwargs.get('to_country', None), kwargs.get('to_country', None)) # Build Request # <FDXRateRequest xmlns:...> request = _.FDXRateAvailableServicesRequest( **{ 'xmlns:api':APIURL , 'xmlns:xsi':XSIURL ,'xsi:noNamespaceSchemaLocation':'FDXRateAvailableServicesRequest.xsd' })[ self.request_header , _.ShipDate[ next_business_day(datetime.now(timezone.Eastern)) ] , _.DropoffType[ 'REQUESTCOURIER' ] , _.WeightUnits[ kwargs.get('weight_units','LBS') ] , _.Weight[ kwargs.get('weight','') ] # FedEx Ground Home Delivery Packaging must be YOURPACKAGING only. , _.Packaging[ kwargs.get('packaging','YOURPACKAGING') ] # Value will be overridden in getResponse() , _.OriginAddress[ _.StateOrProvinceCode[ kwargs.get('from_state','') ] , _.PostalCode[ kwargs.get('from_zip_code','') ] , _.CountryCode[ kwargs.get('from_country','US') ] ] , _.DestinationAddress[ _.StateOrProvinceCode[ kwargs.get('to_state','') ] , _.PostalCode[ kwargs.get('to_zip_code','') ] , _.CountryCode[ kwargs.get('to_country','US') ] ] , _.PackageCount[ 1 ] , _.Payment ] self.requestxml = xml_document(request)