<commit_before>%
% (c) The University of Glasgow, 2000
%
\section{Package manipulation}

\begin{code}
module Packages ( PackageConfig(..), 
		  defaultPackageConfig,
		  mungePackagePaths,
		  showPackages
		)
where

#include "HsVersions.h"
import Pretty

import CmdLineOpts	( dynFlag, verbosity )
import DriverUtil	( my_prefix_match )
import ErrUtils		( dumpIfSet )
import Outputable	( docToSDoc, trace )
\end{code}

\begin{code}
#define WANT_PRETTY
-- Yes, do generate pretty-printing stuff for packages

-- There's a blob of code shared with ghc-pkg, 
-- so we just include it from there 
#include "../utils/ghc-pkg/Package.hs"
\end{code}

%*********************************************************
%*						 	 *
\subsection{Load the config file}
%*							 *
%*********************************************************

\begin{code}
mungePackagePaths :: String -> [PackageConfig] -> [PackageConfig]
-- Replace the string "$libdir" at the beginning of a path
-- with the current libdir (obtained from the -B option).
mungePackagePaths top_dir ps = map munge_pkg ps
 where 
  munge_pkg p = p{ import_dirs  = munge_paths (import_dirs p),
		   include_dirs = munge_paths (include_dirs p),
    		   library_dirs = munge_paths (library_dirs p) }

  munge_paths = map munge_path

  munge_path p 
	  | Just p' <- my_prefix_match "$libdir" p = top_dir ++ p'
	  | otherwise				   = trace ("not: " ++ p) p
\end{code}


%*********************************************************
%*						 	 *
\subsection{Display results}
%*							 *
%*********************************************************
<commit_msg>[project @ 2001-07-17 15:48:21 by simonpj] Remove trace<commit_after>%
% (c) The University of Glasgow, 2000
%
\section{Package manipulation}

\begin{code}
module Packages ( PackageConfig(..), 
		  defaultPackageConfig,
		  mungePackagePaths,
		  showPackages
		)
where

#include "HsVersions.h"
import Pretty

import CmdLineOpts	( dynFlag, verbosity )
import DriverUtil	( my_prefix_match )
import ErrUtils		( dumpIfSet )
import Outputable	( docToSDoc, trace )
\end{code}

\begin{code}
#define WANT_PRETTY
-- Yes, do generate pretty-printing stuff for packages

-- There's a blob of code shared with ghc-pkg, 
-- so we just include it from there 
#include "../utils/ghc-pkg/Package.hs"
\end{code}

%*********************************************************
%*						 	 *
\subsection{Load the config file}
%*							 *
%*********************************************************

\begin{code}
mungePackagePaths :: String -> [PackageConfig] -> [PackageConfig]
-- Replace the string "$libdir" at the beginning of a path
-- with the current libdir (obtained from the -B option).
mungePackagePaths top_dir ps = map munge_pkg ps
 where 
  munge_pkg p = p{ import_dirs  = munge_paths (import_dirs p),
		   include_dirs = munge_paths (include_dirs p),
    		   library_dirs = munge_paths (library_dirs p) }

  munge_paths = map munge_path

  munge_path p 
	  | Just p' <- my_prefix_match "$libdir" p = top_dir ++ p'
	  | otherwise				   = p
\end{code}


%*********************************************************
%*						 	 *
\subsection{Display results}
%*							 *
%*********************************************************

{'fraction_non_alphanumeric': 0.23822887433738696, 'fraction_numerical': 0.006859993763642033, 'mean_word_length': 4.100158982511924, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '495717', 'n_tokens_mistral': 1111, 'n_tokens_neox': 985, 'n_words': 271}