Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go123
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go123
Commits
19d1eba8
Commit
19d1eba8
authored
Jan 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracing/pyruntraced: pymain moved -> pygolang
To ->
pygolang@32a21d5b
parent
87228e62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
44 deletions
+6
-44
tracing/cmd/pyruntraced
tracing/cmd/pyruntraced
+6
-44
No files found.
tracing/cmd/pyruntraced
View file @
19d1eba8
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
# Copyright (C) 2018
-2019
Nexedi SA and Contributors.
#
Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
...
...
@@ -236,7 +236,8 @@ def trace_entry(func, eventname):
# ----------------------------------------
import
os
,
sys
,
code
,
runpy
import
os
,
sys
from
gpython
import
pymain
def
usage
(
out
):
print
>>
out
,
"Usage: pyruntraced <fd> <trace>* -- ..."
...
...
@@ -288,47 +289,8 @@ def main():
# tracing code.
execfile
(
t
,
globals
())
# now mimic `python ...` # XXX -> mimicpython(argv) ? pythonmain(argv) ?
# interactive console
if
not
argv
:
code
.
interact
()
return
# -c command
if
argv
[
0
]
==
'-c'
:
sys
.
argv
=
argv
[
0
:
1
]
+
argv
[
2
:]
# python leaves '-c' as argv[0]
# exec with the same globals `python -c ...` does
g
=
{
'__name__'
:
'__main__'
,
'__doc__'
:
None
,
'__package__'
:
None
}
exec
argv
[
1
]
in
g
# -m module
elif
argv
[
0
]
==
'-m'
:
# search sys.path for module and run corresponding .py file as script
sys
.
argv
=
argv
[
1
:]
runpy
.
run_module
(
sys
.
argv
[
0
],
init_globals
=
{
'__doc__'
:
None
},
run_name
=
'__main__'
)
elif
argv
[
0
].
startswith
(
'-'
):
die
(
"invalid option '%s'"
%
argv
[
0
])
# file
else
:
sys
.
argv
=
argv
filepath
=
argv
[
0
]
# exec with same globals `python file.py` does
# XXX use runpy.run_path() instead?
g
=
{
'__name__'
:
'__main__'
,
'__file__'
:
filepath
,
'__doc__'
:
None
,
'__package__'
:
None
}
execfile
(
filepath
,
g
)
return
# now mimic `python ...`
pymain
(
argv
)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment