Exemplo n.º 1
0
 def upload_to_pypi(self, suppress=False):
     """Uploads package to PyPi using twine.
     The advantage to using Twine is your package is uploaded
     over HTTPS which prevents your private info from appearing
     in the request header. (Apparently setuptools uploads over
     https now as well, so find out more about that.
     """
     # TODO: This doesn't need to be twine anymore. ALTHOUGH, make sure ...
     # the default pip or setuptools uses https _without_ needing to be
     # upgraded first. Because if not, that makes twine the most secure
     # way.
     suppress = suppress or self.verbose
     if not os.path.exists(os.path.expanduser('~/.pypirc')):
         msg = (
             "No .pypirc found. Please see "
             "https://docs.python.org/2/distutils/packageindex.html#pypirc "
             "for more info.")
         logger.warning(msg)
         self.errors.append(msg)
         return
     logger.info("Uploading Project to the Pypi server..")
     with dir_context(self.build_dir):
         response = execute_shell_command("twine upload dist/*",
                                          suppress=suppress)
         logger.info("Project has been uploaded to the Pypi server!")
         logger.debug("Result: %s", repr(response))
         self.parse_response(response)
     self.uploaded = True
     return response
Exemplo n.º 2
0
 def preview_readme(self):
     """Open a preview of your readme in restview."""
     if not self.package.PACKAGE_FILES['readme_rst']:
         self.build_readme()
     with dir_context(self.build_dir):
         logger.info("Opening README.rst in restview. ")
         with ignore_stdout():
             shell = subprocess.Popen("restview README.rst".split(" "),
                                      stdout=devnull)
         return shell
Exemplo n.º 3
0
 def build_distros(self, suppress=False):
     """Builds out project distros, console output can be suppressed
      by setting show_output to True.
      """
     suppress = suppress or self.verbose
     with dir_context(self.build_dir):
         for cmd in self.commands:
             # TODO: This needs to be better. Not enough info on the build.
             logger.info("Executing command - %s", str(cmd))
             execute_shell_command(cmd, suppress=suppress)
             logger.info("Done.")
Exemplo n.º 4
0
 def register_pypi_test_package(self, suppress=False):
     """Registers your package with the PyPi test site. This step doesn't
      seem to be necessary for the regular PyPi site though..
      """
     # TODO: Needs research.. See docstring.
     suppress = suppress or self.verbose
     with dir_context(self.build_dir):
         logger.info("Uploading Project to the Pypi TESTING server..")
         cmd = "python setup.py register -r %s" % self.pypi_test_url
         response = execute_shell_command(cmd, suppress=suppress)
         # self.parse_response(response)
     return response
Exemplo n.º 5
0
 def upload_to_pypi_test_site(self, suppress=False):
     """Uploads your package to the PyPi repository allowing others
     to download easily with pip"""
     suppress = suppress or self.verbose
     with dir_context(self.build_dir):
         logger.info("Uploading Project to the Pypi TESTING server..")
         response = execute_shell_command("twine upload dist/* -r testpypi",
                                          suppress=suppress)
         logger.info(
             "Project has been uploaded to the Pypi TESTING server!")
         logger.debug("Result: %s", repr(response))
         # TODO: This needs to be better..
         self.parse_response(response)
     self.uploaded = True
     return response