Skip to content

Commit

Permalink
add code and style checking to test/build (flake8); support --args fl…
Browse files Browse the repository at this point in the history
…ag (#126)
  • Loading branch information
cs01 committed Nov 16, 2017
1 parent e1041f4 commit 2c1543c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -26,7 +26,7 @@ matrix:

before_install:
# install collective.checkdocs to allow for python setup.py test command to work
- pip install collective.checkdocs
- pip install -r dev_requirements.txt
- yarn install
# commands for linux
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gdb ; fi
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,7 +3,9 @@
## dev
Changes that are in master but have not yet been pushed to PyPI.

* Optional authentication
* Add optional authentication (@nickamon, issue #132)
* Support the `--args` flag (issue #126)
* Ensure code is correct and adheres to recommended Python style when running tests/building (flake8)

## 0.8.1.0
* Add autocomplete functionality (@bobthekingofegypt, issue #129)
Expand Down
1 change: 1 addition & 0 deletions dev_requirements.txt
@@ -1 +1,2 @@
collective.checkdocs==0.2
flake8==3.5.0
12 changes: 10 additions & 2 deletions gdbgui/backend.py
Expand Up @@ -432,7 +432,7 @@ def main():
'Pass this flag when debugging gdbgui itself to automatically reload the server when changes are detected', action='store_true')
parser.add_argument('-n', '--no_browser', help='By default, the browser will open with gdb gui. Pass this flag so the browser does not open.', action='store_true')
parser.add_argument('-x', '--gdb_cmd_file', help='Execute GDB commands from file.')

parser.add_argument('--args', nargs='+', help='(Optional) The binary and arguments to run in gdb. Example: gdbgui --args "./mybinary myarg -flag1 -flag2"')
parser.add_argument('--auth-file', help='Specify a file that contains the HTTP Basic auth username and password separate by newline. NOTE: gdbgui does not use https.')

args = parser.parse_args()
Expand All @@ -441,7 +441,15 @@ def main():
print(__version__)
return

app.config['initial_binary_and_args'] = ' '.join(args.cmd)
if len(args.cmd) and len(args.args):
print('Cannot specify command and args. Must specify one or the other.')
exit(1)
print(args.args)
if args.cmd:
cmd = args.cmd
else:
cmd = args.args
app.config['initial_binary_and_args'] = ' '.join(cmd or [])
app.config['gdb_path'] = args.gdb
app.config['gdb_cmd_file'] = args.gdb_cmd_file
app.config['show_gdbgui_upgrades'] = not args.hide_gdbgui_upgrades
Expand Down
1 change: 1 addition & 0 deletions makefile
@@ -1,6 +1,7 @@
# run pip install -r dev_requirements.txt before running make test
.PHONY: test publish
test:
flake8 gdbgui/backend.py --ignore=E121,E123,E126,E128,E501
python setup.py test
yarn build
python setup.py checkdocs
Expand Down

0 comments on commit 2c1543c

Please sign in to comment.