Repository: conda/conda-build

Issue:
Conda build purge-all not documented
Can we document the conda build purge-all command? It isn't shown anywhere I can see. I had to find  #2592 to learn about it. I think conda build purge isn't really documented either, but at least there's output that instructs you to use it.

Thanks!

##### `Output of conda info`
<!-- Between the ticks below, paste the output of 'conda info' -->
```
$ conda info

     active environment : py36-meanfield
    active env location : /miniconda2/envs/py36-meanfield
            shell level : 1
       user config file : /.condarc
 populated config files : /.condarc
          conda version : 4.5.11
    conda-build version : 3.14.4
         python version : 2.7.14.final.0
       base environment : /miniconda2  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /miniconda2/pkgs
                          /.conda/pkgs
       envs directories : /home/envs
                          /.conda/envs
               platform : linux-64
             user-agent : conda/4.5.11 requests/2.18.4 CPython/2.7.14 Linux/3.10.0-862.11.6.el7.x86_64 rhel/7.5 glibc/2.17
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

```




Discussion:
Sure, "we" can.  It might take me a long time to get to it, though.  Feel free to submit a PR in the meantime.

Resolving patch:
diff --git a/conda_build/build.py b/conda_build/build.py
--- a/conda_build/build.py
+++ b/conda_build/build.py
@@ -1851,7 +1851,7 @@ def write_build_scripts(m, script, build_file):
         bf.write("\tsource {}\n".format(env_file))
         bf.write("fi\n")
         if script:
-                bf.write(script)
+            bf.write(script)
         if isfile(build_file) and not script:
             bf.write(open(build_file).read())
 
diff --git a/conda_build/cli/main_build.py b/conda_build/cli/main_build.py
--- a/conda_build/cli/main_build.py
+++ b/conda_build/cli/main_build.py
@@ -98,7 +98,8 @@ def parse_args(args):
         metavar='RECIPE_PATH',
         nargs='+',
         help="Path to recipe directory.  Pass 'purge' here to clean the "
-        "work and test intermediates.",
+        "work and test intermediates. Pass 'purge-all' to also remove "
+        "previously built packages.",
     )
     p.add_argument(
         '--skip-existing',
diff --git a/conda_build/metadata.py b/conda_build/metadata.py
--- a/conda_build/metadata.py
+++ b/conda_build/metadata.py
@@ -1733,9 +1733,9 @@ def uses_subpackage(self):
                     break
         subpackage_pin = False
         if not in_reqs and self.meta_path:
-                data = self.extract_requirements_text(force_top_level=True)
-                if data:
-                    subpackage_pin = re.search("{{\s*pin_subpackage\(.*\)\s*}}", data)
+            data = self.extract_requirements_text(force_top_level=True)
+            if data:
+                subpackage_pin = re.search("{{\s*pin_subpackage\(.*\)\s*}}", data)
         return in_reqs or bool(subpackage_pin)
 
     @property


Test patch: