Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
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
Jérome Perrin
apachedex
Commits
6045932f
Commit
6045932f
authored
Apr 14, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pkgutil instead of pkg_resources.
parent
fcdcc68b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
15 deletions
+5
-15
apachedex/__init__.py
apachedex/__init__.py
+5
-15
No files found.
apachedex/__init__.py
View file @
6045932f
...
...
@@ -42,23 +42,16 @@ import itertools
import
json
import
math
import
os
import
pkgutil
import
platform
import
re
import
shlex
import
sys
import
time
import
traceback
try
:
import
pkg_resources
except
ImportError
:
# By default, assume resources are next to __file__
abs_file_container
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
def
getResource
(
name
):
return
open
(
os
.
path
.
join
(
abs_file_container
,
name
)).
read
()
else
:
abs_file_container
=
None
def
getResource
(
name
):
return
pkg_resources
.
resource_string
(
__name__
,
name
)
def
getResource
(
name
,
encoding
=
'utf-8'
):
return
pkgutil
.
get_data
(
__name__
,
name
).
decode
(
encoding
)
FILE_OPENER_LIST
=
[
(
gzip
.
open
,
IOError
),
...
...
@@ -1100,7 +1093,6 @@ def _scanstring(*args, **kw):
json
.
decoder
.
scanstring
=
_scanstring
def
main
():
global
abs_file_container
parser
=
ShlexArgumentParser
(
description
=
'Compute Apdex out of '
'apache-style log files'
,
fromfile_prefix_chars
=
'@'
)
parser
.
add_argument
(
'logfile'
,
nargs
=
'*'
,
...
...
@@ -1134,8 +1126,7 @@ def main():
group
.
add_argument
(
'-s'
,
'--stats'
,
action
=
'store_true'
,
help
=
'Enable parsing stats (time spent parsing input, time spent '
'generating output, ...)'
)
group
.
add_argument
(
'--js'
,
default
=
abs_file_container
,
help
=
'Folder containing needed js files. Default: %(default)s'
)
group
.
add_argument
(
'--js'
,
help
=
'Folder containing needed js files.'
)
group
.
add_argument
(
'--js-embed'
,
action
=
'store_true'
,
help
=
'Embed js files instead of linking to them.'
)
group
.
add_argument
(
'--fixed-yrange'
,
nargs
=
'?'
,
type
=
int
,
const
=-
1
,
...
...
@@ -1171,7 +1162,6 @@ def main():
'ignored. Useful to exclude monitoring systems.'
)
args
=
parser
.
parse_args
()
abs_file_container
=
getattr
(
args
,
'js'
,
abs_file_container
)
if
DURATION_US_FORMAT
in
args
.
logformat
:
getDuration
=
lambda
x
:
int
(
x
.
group
(
'duration'
))
elif
DURATION_S_FORMAT
in
args
.
logformat
:
...
...
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