I am using setuptools to package code such that it can be easily installed using
cd project_name && pip install .
During the setup process, I want to warn the user about pre-existing config files and print some post install instructions on the system. For example
/etc/project_name/project.conf exists. Not copying default config file.
I have tried to use print
and logging.warning()
but still the warnings don't appear when installing using pip. I have a feeling I am missing something obvious.
We are trying to support 3.0 > python >= 2.6 on Redhat family >= el6 and Ubuntu >= 14.04LTS
If you take a look at the pip source, in the function responsible for running the setup script, call_subprocess
(source here), it says:
def call_subprocess(cmd, show_stdout=False, cwd=None, ..."""Args:show_stdout: if true, use INFO to log the subprocess's stderr andstdout streams. Otherwise, use DEBUG. Defaults to False...."""...# Most places in pip use show_stdout=False. What this means is--## - We connect the child's output (combined stderr and stdout) to a# single pipe, which we read.# - We log this output to stderr at DEBUG level as it is received.# - If DEBUG logging isn't enabled (e.g. if --verbose logging wasn't# requested), then we show a spinner so the user can still see the# subprocess is in progress.# - If the subprocess exits with an error, we log the output to stderr# at ERROR level if it hasn't already been displayed to the console# (e.g. if --verbose logging wasn't enabled). This way we don't log# the output to the console twice.## If show_stdout=True, then the above is still done, but with DEBUG# replaced by INFO.
In short, you can see the output only if:
- your setup exits with an error, or
- user calls pip with
-v
, the verbose flag