To Do list for improving code idioms
####################################

To Do
=====

* Ensure all files explicitly opened are closed correctly.

* Encapsulate application state in a class.

  * dput.dput.PackageUploadApplication
  * dput.dcut.CommandUploadApplication

* Reduce ‘if __name__ == '__main__'’ block to minimum.

* Use idiomatic ‘configparser’ processing.

  * Migrate to ‘ConfigParser.read’ method.
  * Remove direct query to ‘DEFAULT’ config section.

* Use ‘str.format’ for all string formatting and interpolation.

  * Remove usage of ‘%’ formatting operator.

* Use ‘argparse’ for command-line parsing.

  * Remove usage of ‘getopt’.

* Use ‘logging’ module throughout for all messages.

  * Remove usage of ‘sys.std{out,err}.write’ for debug-level messages.
  * Remove usage of ‘sys.std{out,err}.write’ for informational messages.
  * Remove usage of ‘sys.std{out,err}.write’ for warning message.
  * Remove usage of ‘sys.std{out,err}.write’ for error messages.
  * Remove usage of ‘sys.std{out,err}.write’ for critical error messages.


Done
====

* Remove use of global variables.

  * dput.dcut.progname
  * dput.dcut.version
  * dput.dcut.USAGE
  * dput.dput.dput_version
  * dput.dput.files_to_remove
  * dput.dput.files_to_upload
  * dput.dput.USAGE
  * dput.dput.config_file
  * dput.dput.config
  * dput.dput.check_only
  * dput.dput.dinstall
  * dput.dput.delay_upload
  * dput.dput.unsigned_upload
  * dput.dput.simulate
  * dput.dput.upload_methods

* Use ‘subprocess’ API for all subprocess interaction.

  * Remove usage of ‘os.popen3’.
  * Migrate ‘os.system’ → ‘subprocess.call’.
  * Migrate ‘os.waitpid’ → ‘subprocess.check_call’.
  * Migrate ‘os.popen’ → ‘subprocess.Popen’.
  * Migrate ‘os.spawnv’ → ‘subprocess.check_call’.

* Use ‘sys.stdout.write’ for all normal output.

  * Remove usage of ‘print’ for normal output.


..
    Local variables:
    coding: utf-8
    mode: rst
    mode: text
    End:
    vim: fileencoding=utf-8 filetype=rst :
