Skip to content

Commit

Permalink
Remove the module imp in centrifuge-inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
mourisl committed Jul 3, 2024
1 parent 627d70a commit c68c367
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions centrifuge-inspect
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,32 @@
along with Centrifuge. If not, see <http://www.gnu.org/licenses/>.
"""


import sys
import os
import imp
#import imp
import inspect
import logging

def build_args():
"""
Parse the wrapper arguments. Returns the options,<programm arguments> tuple.
"""

parsed_args = {}
to_remove = []
argv = sys.argv[:]
for i, arg in enumerate(argv):
if arg == '--debug':
parsed_args[arg] = ""
to_remove.append(i)
elif arg == '--verbose':
parsed_args[arg] = ""
to_remove.append(i)

for i in reversed(to_remove):
del argv[i]

return parsed_args, argv


def main():
Expand All @@ -35,8 +55,8 @@ def main():
curr_script = os.path.realpath(inspect.getsourcefile(main))
ex_path = os.path.dirname(curr_script)
inspect_bin_spec = os.path.join(ex_path, "centrifuge-inspect-bin")
bld = imp.load_source('centrifuge-build', os.path.join(ex_path,'centrifuge-build'))
options,arguments = bld.build_args()
#bld = imp.load_source('centrifuge-build', os.path.join(ex_path,'centrifuge-build'))
options,arguments = build_args()

if '--verbose' in options:
logging.getLogger().setLevel(logging.INFO)
Expand Down

0 comments on commit c68c367

Please sign in to comment.