コード例 #1
0
 def _get_cmd(self, metadata=None):
     if metadata is None:
         metadata = {'url': 'xxx', 'author': 'xxx',
                     'author_email': 'xxx',
                     'name': 'xxx', 'version': 'xxx'}
     pkg_info, dist = self.create_dist(**metadata)
     return register(dist)
コード例 #2
0
ファイル: smartuploader.py プロジェクト: isotoma/chishop
 def register(self):
     """Register a distribution code version of:
     python setup.py register -r chishop --show-response
     """
     r = register(self.distribution)
     r.repository = self.repository
     r.run()
     print '%s registered... ' % (self.filename),
コード例 #3
0
ファイル: test_register.py プロジェクト: 5l1v3r1/python-10
    def test_create_pypirc(self):
        # this test makes sure a .pypirc file
        # is created when requested.

        # let's create a fake distribution
        # and a register instance
        dist = Distribution()
        dist.metadata.url = 'xxx'
        dist.metadata.author = 'xxx'
        dist.metadata.author_email = 'xxx'
        dist.metadata.name = 'xxx'
        dist.metadata.version =  'xxx'
        cmd = register(dist)

        # we shouldn't have a .pypirc file yet
        self.assert_(not os.path.exists(self.rc))

        # patching raw_input and getpass.getpass
        # so register gets happy
        #
        # Here's what we are faking :
        # use your existing login (choice 1.)
        # Username : '******'
        # Password : '******'
        # Save your login (y/N)? : 'y'
        inputs = RawInputs('1', 'tarek', 'y')
        from distutils.command import register as register_module
        register_module.raw_input = inputs.__call__

        cmd.post_to_server = pypi_server = FakeServer()

        # let's run the command
        cmd.run()

        # we should have a brand new .pypirc file
        self.assert_(os.path.exists(self.rc))

        # with the content similar to WANTED_PYPIRC
        content = open(self.rc).read()
        self.assertEquals(content, WANTED_PYPIRC)

        # now let's make sure the .pypirc file generated
        # really works : we shouldn't be asked anything
        # if we run the command again
        def _no_way(prompt=''):
            raise AssertionError(prompt)
        register_module.raw_input = _no_way

        cmd.run()

        # let's see what the server received : we should
        # have 2 similar requests
        self.assert_(len(pypi_server.calls), 2)
        self.assert_(pypi_server.calls[0], pypi_server.calls[1])
コード例 #4
0
ファイル: test_register.py プロジェクト: 5l1v3r1/python-10
    def test_password_not_in_file(self):

        f = open(self.rc, 'w')
        f.write(PYPIRC_NOPASSWORD)
        f.close()

        dist = Distribution()
        cmd = register(dist)
        cmd.post_to_server = FakeServer()

        cmd._set_config()
        cmd.finalize_options()
        cmd.send_metadata()

        # dist.password should be set
        # therefore used afterwards by other commands
        self.assertEquals(dist.password, 'password')
コード例 #5
0
 def _get_cmd(self, metadata=None):
     if metadata is None:
         metadata = {"url": "xxx", "author": "xxx", "author_email": "xxx", "name": "xxx", "version": "xxx"}
     pkg_info, dist = self.create_dist(**metadata)
     return register(dist)
コード例 #6
0
ファイル: dumbuploader.py プロジェクト: guoqiao/chishop
 def register(self):
     #python setup.py register -r chishop --show-response
     r = register(self.distribution)
     r.repository = self.repository
     r.run()
     print '%s registered' %(self.filename)
コード例 #7
0
 def register(self):
     #python setup.py register -r chishop --show-response
     r = register(self.distribution)
     r.repository = self.repository
     r.run()
     print '%s registered' % (self.filename)