Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellanous fixups of a miscellaneous nature #171

Closed
wants to merge 7 commits into from

Commits on Jul 1, 2018

  1. Use real python to handle file operations.

    Don't fork subprocesses in order to handle things in the stdlib (python
    has a very decent in-process C module for this). Also DRY. Also better
    chained error messages.
    eli-schwartz committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    dd4b071 View commit details
    Browse the repository at this point in the history
  2. Dramatically reduce the number of subprocesses run

    In nearly every case it is better to run subprocess.run() without the
    burden of forking a bash shell too. All it takes is to turn strings into
    arrays of strings and *remove* some use of formatting.
    
    Aurman specifically, does not use *any* of the fancy shell
    interpretation that sometimes makes forking a shell to fork the
    commands, a worthwhile endeavor. So don't do so.
    
    This is further cleanup after the removal of subprocesses for file
    operations. Only changes where this cleanly applies have been done for
    now... in a followup commit, subprocesses that handle arguments as
    heavily-quoted strings will be handled.
    eli-schwartz committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    aec5f30 View commit details
    Browse the repository at this point in the history
  3. Dramatically reduce the number of subprocesses run, part 2

    Some functions pass around lots of string-formatted arguments. Handling
    this properly would require major refactoring to use lists everywhere.
    For now, use shlex to convert strings to a proper list-based array that
    subprocess.run can elegantly handle without running its own shell
    parser.
    eli-schwartz committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    4b26dcd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f9f703b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b13eccd View commit details
    Browse the repository at this point in the history
  6. Write directly to file objects when possible.

    Instead of decoding the stdout of subprocess.run and then doing our own
    writes, just hand subprocess the file object and let it write directly.
    eli-schwartz committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    637682d View commit details
    Browse the repository at this point in the history
  7. Refactor to use slightly more efficient list construction

    Appending is a bit faster than constucting new lists on top of the old
    ones. It also avoids the need to use two lists.
    eli-schwartz committed Jul 1, 2018
    Configuration menu
    Copy the full SHA
    bb1a936 View commit details
    Browse the repository at this point in the history