Exemple #1
0
    def test_server_registration(self):
        # This test makes sure we know how to:
        # 1. handle several sections in .pypirc
        # 2. handle the old format

        # new format
        self.write_file(self.rc, PYPIRC)
        config = read_pypirc()

        config = config.items()
        config.sort()
        expected = [('password', 'xxxx'), ('realm', 'pypi'),
                    ('repository', 'http://pypi.python.org/pypi'),
                    ('server', 'pypi'), ('username', 'me')]
        self.assertEqual(config, expected)

        # old format
        self.write_file(self.rc, PYPIRC_OLD)
        config = read_pypirc()
        config = config.items()
        config.sort()
        expected = [('password', 'secret'), ('realm', 'pypi'),
                    ('repository', 'http://pypi.python.org/pypi'),
                    ('server', 'server-login'), ('username', 'tarek')]
        self.assertEqual(config, expected)
Exemple #2
0
 def _set_config(self):
     ''' Reads the configuration file and set attributes.
     '''
     config = read_pypirc(self.repository, self.realm)
     if config != {}:
         self.username = config['username']
         self.password = config['password']
         self.repository = config['repository']
         self.realm = config['realm']
         self.has_config = True
     else:
         if self.repository not in ('pypi', DEFAULT_REPOSITORY):
             raise ValueError('%s not found in .pypirc' % self.repository)
         if self.repository == 'pypi':
             self.repository = DEFAULT_REPOSITORY
         self.has_config = False
Exemple #3
0
 def _set_config(self):
     ''' Reads the configuration file and set attributes.
     '''
     config = read_pypirc(self.repository, self.realm)
     if config != {}:
         self.username = config['username']
         self.password = config['password']
         self.repository = config['repository']
         self.realm = config['realm']
         self.has_config = True
     else:
         if self.repository not in ('pypi', DEFAULT_REPOSITORY):
             raise ValueError('%s not found in .pypirc' % self.repository)
         if self.repository == 'pypi':
             self.repository = DEFAULT_REPOSITORY
         self.has_config = False
Exemple #4
0
 def finalize_options(self):
     if self.repository is None:
         self.repository = DEFAULT_REPOSITORY
     if self.realm is None:
         self.realm = DEFAULT_REALM
     if self.upload_dir is None:
         build = self.get_finalized_command('build')
         self.upload_dir = os.path.join(build.build_base, "docs")
         if not os.path.isdir(self.upload_dir):
             self.upload_dir = os.path.join(build.build_base, "doc")
     logger.info('Using upload directory %s', self.upload_dir)
     self.verify_upload_dir(self.upload_dir)
     config = read_pypirc(self.repository, self.realm)
     if config != {}:
         self.username = config['username']
         self.password = config['password']
         self.repository = config['repository']
         self.realm = config['realm']
Exemple #5
0
 def finalize_options(self):
     if self.repository is None:
         self.repository = DEFAULT_REPOSITORY
     if self.realm is None:
         self.realm = DEFAULT_REALM
     if self.upload_dir is None:
         build = self.get_finalized_command('build')
         self.upload_dir = os.path.join(build.build_base, "docs")
         if not os.path.isdir(self.upload_dir):
             self.upload_dir = os.path.join(build.build_base, "doc")
     logger.info('Using upload directory %s', self.upload_dir)
     self.verify_upload_dir(self.upload_dir)
     config = read_pypirc(self.repository, self.realm)
     if config != {}:
         self.username = config['username']
         self.password = config['password']
         self.repository = config['repository']
         self.realm = config['realm']
Exemple #6
0
    def finalize_options(self):
        if self.repository is None:
            self.repository = DEFAULT_REPOSITORY
        if self.realm is None:
            self.realm = DEFAULT_REALM
        if self.identity and not self.sign:
            raise PackagingOptionError(
                "Must use --sign for --identity to have meaning")
        config = read_pypirc(self.repository, self.realm)
        if config != {}:
            self.username = config['username']
            self.password = config['password']
            self.repository = config['repository']
            self.realm = config['realm']

        # getting the password from the distribution
        # if previously set by the register command
        if not self.password and self.distribution.password:
            self.password = self.distribution.password
Exemple #7
0
    def finalize_options(self):
        if self.repository is None:
            self.repository = DEFAULT_REPOSITORY
        if self.realm is None:
            self.realm = DEFAULT_REALM
        if self.identity and not self.sign:
            raise PackagingOptionError(
                "Must use --sign for --identity to have meaning")
        config = read_pypirc(self.repository, self.realm)
        if config != {}:
            self.username = config['username']
            self.password = config['password']
            self.repository = config['repository']
            self.realm = config['realm']

        # getting the password from the distribution
        # if previously set by the register command
        if not self.password and self.distribution.password:
            self.password = self.distribution.password