我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用distutils.errors.DistutilsArgError()。
def finalize_options(self): orig.install.finalize_options(self) if self.root: self.single_version_externally_managed = True elif self.single_version_externally_managed: if not self.root and not self.record: raise DistutilsArgError( "You must specify --record or --root when building system" " packages" )
def finalize_options(self): _install.finalize_options(self) if self.root: self.single_version_externally_managed = True elif self.single_version_externally_managed: if not self.root and not self.record: raise DistutilsArgError( "You must specify --record or --root when building system" " packages" )
def run(self): """Run command.""" self.run_command('ldist') ldist_cmd = self.get_finalized_command('ldist') dist_path = getattr(ldist_cmd, 'dist_path', None) dist_name = getattr(ldist_cmd, 'dist_name', None) if dist_path is None or dist_name is None: raise DistutilsArgError('\'ldist\' missing attributes') dist_name = getattr(self, 's3_prefix') + dist_name s3 = boto3.client( 's3', aws_access_key_id=getattr(self, 'access_key'), aws_secret_access_key=getattr(self, 'secret_access_key'), config=Config(signature_version='s3v4') ) log.info('uploading {} to {} using kms key {}'.format( dist_name, getattr(self, 's3_bucket'), getattr(self, 'kms_key_id') )) with open(dist_path, 'rb') as dist: if getattr(self, 'kms_key_id'): response = s3.put_object( Body=dist, Bucket=getattr(self, 's3_bucket'), Key=dist_name, ServerSideEncryption='aws:kms', SSEKMSKeyId=getattr(self, 'kms_key_id') ) else: response = s3.put_object( Body=dist, Bucket=getattr(self, 's3_bucket'), Key=dist_name, ServerSideEncryption='AES256' ) log.info('upload complete:\n{}'.format( json.dumps(response, sort_keys=True, indent=4, separators=(',', ': '))) )