make it work with python3

This commit is contained in:
aalok.sathe 2019-02-12 10:36:27 -05:00
parent 15208540da
commit b0423cdfe6

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""pipreqs - Generate pip requirements.txt file based on imports """pipreqs - Generate pip requirements.txt file based on imports
@ -32,7 +32,7 @@ Options:
--clean <file> Clean up requirements.txt by removing modules --clean <file> Clean up requirements.txt by removing modules
that are not imported in project. that are not imported in project.
""" """
from __future__ import print_function, absolute_import # from __future__ import print_function, absolute_import
from contextlib import contextmanager from contextlib import contextmanager
import os import os
import sys import sys
@ -46,7 +46,10 @@ import requests
from yarg import json2package from yarg import json2package
from yarg.exceptions import HTTPError from yarg.exceptions import HTTPError
from pipreqs import __version__ try:
from pipreqs import __version__
except ImportError:
from __init__ import __version__
REGEXP = [ REGEXP = [
re.compile(r'^import (.+)$'), re.compile(r'^import (.+)$'),