67
67
# Packages that should be ignored later.
68
68
BAD_PACKAGES = (
69
69
'setuptools' , 'pip' , 'wheel' , 'six' , 'packaging' , 'distribute'
70
- 'pyparsing' , 'appdirs' , 'pipenv'
70
+ 'pyparsing' , 'appdirs' ,
71
71
)
72
72
73
73
# Are we using the default Python?
@@ -984,7 +984,7 @@ def do_lock(verbose=False, system=False, clear=False):
984
984
# Run the PEP 508 checker in the virtualenv, add it to the lockfile.
985
985
cmd = '"{0}" {1}' .format (which ('python' , allow_global = system ), shellquote (pep508checker .__file__ .rstrip ('cdo' )))
986
986
c = delegator .run (cmd )
987
- lockfile ['_meta' ]['host-environment-markers' ] = json .loads (c .out )
987
+ lockfile ['_meta' ]['host-environment-markers' ] = simplejson .loads (c .out )
988
988
989
989
# Write out the lockfile.
990
990
with open (project .lockfile_location , 'w' ) as f :
@@ -1950,9 +1950,6 @@ def graph(bare=False, json=False):
1950
1950
)
1951
1951
sys .exit (1 )
1952
1952
1953
- if json :
1954
- bare = True
1955
-
1956
1953
j = '--json' if json else ''
1957
1954
1958
1955
cmd = '"{0}" {1} {2}' .format (
@@ -1967,23 +1964,28 @@ def graph(bare=False, json=False):
1967
1964
if not bare :
1968
1965
1969
1966
if json :
1970
- data = simplejson . loads ( c . out )
1971
- print ( data )
1967
+ data = []
1968
+ for d in simplejson . loads ( c . out ):
1972
1969
1970
+ if d ['package' ]['key' ] not in BAD_PACKAGES :
1971
+ data .append (d )
1973
1972
1974
- for line in c .out .split ('\n ' ):
1973
+ click .echo (simplejson .dumps (data , indent = 4 ))
1974
+ sys .exit (0 )
1975
+ else :
1976
+ for line in c .out .split ('\n ' ):
1975
1977
1976
- # Ignore bad packages.
1977
- if line .split ('==' )[0 ] in BAD_PACKAGES :
1978
- continue
1978
+ # Ignore bad packages.
1979
+ if line .split ('==' )[0 ] in BAD_PACKAGES :
1980
+ continue
1979
1981
1980
- # Bold top-level packages.
1981
- if not line .startswith (' ' ):
1982
- click .echo (crayons .white (line , bold = True ))
1982
+ # Bold top-level packages.
1983
+ if not line .startswith (' ' ):
1984
+ click .echo (crayons .white (line , bold = True ))
1983
1985
1984
- # Echo the rest.
1985
- else :
1986
- click .echo (crayons .white (line , bold = False ))
1986
+ # Echo the rest.
1987
+ else :
1988
+ click .echo (crayons .white (line , bold = False ))
1987
1989
else :
1988
1990
click .echo (c .out )
1989
1991
0 commit comments