MCPcopy Create free account
hub / github.com/aws/aws-cli / login

Method login

awscli/customizations/codeartifact/login.py:628–661  ·  view source on GitHub ↗
(self, dry_run=False)

Source from the content-addressed store, hash-verified

626 return pypi_rc_str
627
628 def login(self, dry_run=False):
629 # No command to execute for Twine, we get the expected pypirc content
630 # instead.
631 pypi_rc_str = self.get_commands(
632 self.repository_endpoint,
633 self.auth_token,
634 pypi_rc_path=self.pypi_rc_path,
635 )
636
637 if dry_run:
638 sys.stdout.write('Dryrun mode is enabled, not writing to pypirc.')
639 sys.stdout.write(os.linesep)
640 sys.stdout.write(
641 f'{self.pypi_rc_path} would have been set to the following:'
642 )
643 sys.stdout.write(os.linesep)
644 sys.stdout.write(os.linesep)
645 sys.stdout.write(pypi_rc_str)
646 sys.stdout.write(os.linesep)
647 else:
648 fd = os.open(self.pypi_rc_path,
649 os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
650
651 try:
652 os.chmod(self.pypi_rc_path, 0o600) # Ensure secure perms on pre-existing files
653 except OSError as e:
654 uni_print('Unable to set file permissions '
655 'for %s: %s%s' % (self.pypi_rc_path, e, os.linesep),
656 sys.stderr)
657
658 with os.fdopen(fd, 'w') as fp:
659 fp.write(pypi_rc_str)
660
661 self._write_success_message('twine')
662
663 @classmethod
664 def get_pypi_rc_path(cls):

Callers

nothing calls this directly

Calls 5

get_commandsMethod · 0.95
uni_printFunction · 0.90
writeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected