Skip to content

Conversation

@kmvanbrunt
Copy link
Member

@kmvanbrunt kmvanbrunt commented Feb 14, 2020

  • Bug Fixes
    • Fixed bug where pyscripts could edit cmd2.Cmd.py_locals dictionary.
    • Fixed bug where cmd2 set sys.path[0] for a pyscript to cmd2's working directory instead of the script file's directory.
    • Fixed bug where sys.path was not being restored after a pyscript ran.
  • Enhancements
    • Setting the following pyscript variables:
      • __name__: main
      • __file__: script path (as typed, ~ will be expanded)
  • Other
    • Removed do_py.run() function since it didn't handle arguments and offered no benefit over run_pyscript.

Fixed bug where cmd2 set sys.path[0] for a pyscript to its cwd instead of the script's directory.
Fixed bug where sys.path was not being restored after a pyscript ran.
Setting the following pyscript variables:
    __name__: __main__
    __file__: script path (as typed)
Removed do_py.run() function since it didn't handle arguments and offered no benefit over run_pyscript.
@codecov
Copy link

codecov bot commented Feb 14, 2020

Codecov Report

Merging #888 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #888      +/-   ##
==========================================
- Coverage   97.44%   97.44%   -0.01%     
==========================================
  Files          14       14              
  Lines        3684     3680       -4     
==========================================
- Hits         3590     3586       -4     
  Misses         94       94
Impacted Files Coverage Δ
cmd2/cmd2.py 96.65% <100%> (ø) ⬆️
cmd2/parsing.py 100% <0%> (ø) ⬆️
cmd2/plugin.py 100% <0%> (ø) ⬆️
cmd2/history.py 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 013b9e0...555db5d. Read the comment docs.

@kmvanbrunt kmvanbrunt changed the title Fixed bug where pyscripts could edit cmd2.Cmd.py_locals dictionary. pyscript fixes Feb 14, 2020
* Renamed set command's `-l/--long` flag to `-v/--verbose` for consistency with help and history commands.
* Setting the following pyscript variables:
* `__name__`: __main__
* `__file__`: script path (as typed, ~ will be expanded)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the removal of do_py.run() be mentioned?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to change log

@kmvanbrunt kmvanbrunt merged commit 729e152 into master Feb 17, 2020
@kmvanbrunt kmvanbrunt deleted the pyscript_fixes branch February 17, 2020 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants