Modernize prepare-dev.py

Review Request #10179 — Created Sept. 25, 2018 and submitted

Information

Review Board
release-2.5.x
62a2eef...

Reviewers

Our prepare-dev.py was doing quite a few things that weren't best
practices:

  • Global mutable state in the form of options.
  • Using the deprecated optparse module instead of argparse.
  • No docstrings anywhere.

These issues have all been addressed. Where we were previously using
global mutable state we now pass our state as an argument to the
function that requires it (create_settings). Our argument parser has
been updated to use argparse.ArgumentParser. The module and all
functions now have docstrings that meet our documentation guidelines.

Additionally, I cleaned up control flow a bit in main() where things
were running in a try..except that didn't need to.

Ran prepare-dev.py and it ran correctly.

Description From Last Updated

E303 too many blank lines (2)

reviewbotreviewbot

It's kind of weird to have this be this late. I know we had a few people run into issues …

daviddavid

typo: cmdling

daviddavid

I think this can just be "Parse the command-line arguments". Creating an argument parser is just an implementation detail that …

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

brennie
david
  1. 
      
  2. contrib/internal/prepare-dev.py (Diff revision 2)
     
     
    Show all issues

    It's kind of weird to have this be this late. I know we had a few people run into issues where trying to import reviewboard.cmdline.rbsite failed because there were missing dependencies. Can we move this up to be the first thing in the file?

  3. 
      
brennie
david
  1. 
      
  2. contrib/internal/prepare-dev.py (Diff revision 3)
     
     
    Show all issues

    typo: cmdling

  3. contrib/internal/prepare-dev.py (Diff revision 3)
     
     
    Show all issues

    I think this can just be "Parse the command-line arguments". Creating an argument parser is just an implementation detail that doesn't have any side effects.

  4. 
      
brennie
david
  1. Ship It!
  2. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (27617ee)