
    xhe                      d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZ ddlmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ ddl Z ddl!Z!	 ddl!m"Z# n# e$$ r	 dd	l!m#Z# Y nw xY wdd
l%m&Z& ddl'm(Z( ddl)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7m8Z8 dZ9dZ:dZ;da<da=dZ>dZ?dZ@dZAdZBg dZCdZDdZE ejF        d           ZGd!d"d#d$d%d&d'ZHd( ZId) ZJd* ZKd+ ZLd, ZMd- ZNd. ZOdMd0ZPd1 ZQd2 ZRdMd3ZSdMd4ZTdMd5ZUdNd7ZVd8 ZWd9 ZX	 dOdPd<ZYd= ZZd> Z[	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dQdRdEZ\dSdGZ]dTdIZ^dTdJZ_dK Z`dL ZadS )Uz6
Tools for converting Cran packages to conda recipes.
    )annotationsN)chain)environlistdirmakedirssep)
basenamecommonprefixexistsisabsisdirisfilejoinnormpathrealpathrelpath)Literal)CSafeDumper)
SafeDumper)dashlist   )source)TemporaryDirectorycc_conda_build)get_or_merge_config)allowed_license_familiesguess_license_family)MetaData)ensure_listrm_rf)DEFAULT_VARIANTSget_package_variantszQ  {archive_keys}
  {git_url_key} {git_url}
  {git_tag_key} {git_tag}
  {patches}
z*  url: {cranurl}{sel}
  {hash_entry}{sel}
z+{{% set version = '{cran_version}' %}}{sel}ab  {version_source}
{version_binary1}
{version_binary2}

{{% set posix = 'm2-' if win else '' %}}
{{% set native = 'm2w64-' if win else '' %}}

package:
  name: {packagename}
  version: {{{{ version|replace("-", "_") }}}}

source:
{source}
{binary1}
{binary2}

build:
  merge_build_host: True{sel_src_and_win}
  # If this is a new build for the same version, increment the build number.
  number: {build_number}
  {skip_os}
  {noarch_generic}

  # This is required to make R link correctly on Linux.
  rpaths:
    - lib/R/lib/
    - lib/
  {script_env}
{suggests}
requirements:
  build:{build_depends}

  host:{host_depends}

  run:{run_depends}

test:
  commands:
    # You can put additional test commands to be run here.
    - $R -e "library('{cran_packagename}')"           # [not win]
    - "\"%R%\" -e \"library('{cran_packagename}')\""  # [win]

  # You can also put a file called run_test.py, run_test.sh, or run_test.bat
  # in the recipe that will be run at test time.

  # requires:
    # Put any additional test requirements here.

about:
  {home_comment}home:{homeurl}
  license: {license}
  {summary_comment}summary:{summary}
  license_family: {license_family}
  {license_file}

{extra_recipe_maintainers}

# The original CRAN metadata for this package was:

{cran_metadata}

# See
# https://docs.conda.io/projects/conda-build for
# more information about meta.yaml

aS  #!/bin/bash

# 'Autobrew' is being used by more and more packages these days
# to grab static libraries from Homebrew bottles. These bottles
# are fetched via Homebrew's --force-bottle option which grabs
# a bottle for the build machine which may not be macOS 10.9.
# Also, we want to use conda packages (and shared libraries) for
# these 'system' dependencies. See:
# https://github.com/jeroen/autobrew/issues/3
export DISABLE_AUTOBREW=1

# R refuses to build packages that mark themselves as Priority: Recommended
mv DESCRIPTION DESCRIPTION.old
grep -va '^Priority: ' DESCRIPTION.old > DESCRIPTION
# shellcheck disable=SC2086
${{R}} CMD INSTALL --build . ${{R_ARGS}}

# Add more build steps here, if they are necessary.

# See
# https://docs.conda.io/projects/conda-build
# for a list of environment variables that are set during the build process.
a  #!/bin/bash

set -o errexit -o pipefail

if {source_pf_bash}; then
  export DISABLE_AUTOBREW=1
  mv DESCRIPTION DESCRIPTION.old
  grep -va '^Priority: ' DESCRIPTION.old > DESCRIPTION
  # shellcheck disable=SC2086
  ${{R}} CMD INSTALL --build . ${{R_ARGS}}
else
  mkdir -p "${{PREFIX}}"/lib/R/library/{cran_packagename}
  mv ./* "${{PREFIX}}"/lib/R/library/{cran_packagename}

  if [[ ${{target_platform}} == osx-64 ]]; then
    pushd "${{PREFIX}}"
      for libdir in lib/R/lib lib/R/modules lib/R/library lib/R/bin/exec sysroot/usr/lib; do
        pushd "${{libdir}}" || exit 1
          while IFS= read -r -d '' SHARED_LIB
          do
            echo "fixing SHARED_LIB ${{SHARED_LIB}}"
            install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5.0-MRO/Resources/lib/libR.dylib "${{PREFIX}}"/lib/R/lib/libR.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libR.dylib "${{PREFIX}}"/lib/R/lib/libR.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/local/clang4/lib/libomp.dylib "${{PREFIX}}"/lib/libomp.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/local/gfortran/lib/libgfortran.3.dylib "${{PREFIX}}"/lib/libgfortran.3.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libquadmath.0.dylib "${{PREFIX}}"/lib/libquadmath.0.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/local/gfortran/lib/libquadmath.0.dylib "${{PREFIX}}"/lib/libquadmath.0.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libgfortran.3.dylib "${{PREFIX}}"/lib/libgfortran.3.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libgcc_s.1.dylib "${{PREFIX}}"/lib/libgcc_s.1.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libiconv.2.dylib "${{PREFIX}}"/sysroot/usr/lib/libiconv.2.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libncurses.5.4.dylib "${{PREFIX}}"/sysroot/usr/lib/libncurses.5.4.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libicucore.A.dylib "${{PREFIX}}"/sysroot/usr/lib/libicucore.A.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libexpat.1.dylib "${{PREFIX}}"/lib/libexpat.1.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libcurl.4.dylib "${{PREFIX}}"/lib/libcurl.4.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /usr/lib/libc++.1.dylib "${{PREFIX}}"/lib/libc++.1.dylib "${{SHARED_LIB}}" || true
            install_name_tool -change /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libc++.1.dylib "${{PREFIX}}"/lib/libc++.1.dylib "${{SHARED_LIB}}" || true
          done <   <(find . \( -type f -iname "*.dylib" -or -iname "*.so" -or -iname "R" \) -print0)
        popd
      done
    popd
  fi
fi
z#!/bin/bash

set -o errexit -o pipefail

mkdir -p "${{PREFIX}}"/lib/R/library/{cran_packagename}
mv ./* "${{PREFIX}}"/lib/R/library/{cran_packagename}
zE"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1
a  if "%target_platform%" == "win-64" goto skip_source_build
"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1
exit 0
:skip_source_build
mkdir %PREFIX%\lib\R\library
robocopy /E . "%PREFIX%\lib\R\library\{cran_packagename}"
if %ERRORLEVEL% NEQ 1 exit /B 1
exit 0
z
    - )SiteArchsDependsEnhancesImportsLicenseLicense_is_FOSSLicense_restricts_use	LinkingToMD5sumNeedsCompilationOS_typePackagePathPrioritySuggestsVersionTitleAuthor
Maintainer)basecompilerdatasetsgraphics	grDevicesgridmethodsparallelsplinesstatsstats4tcltktoolsutils)MASSlatticeMatrixnlmesurvivalbootcluster	codetoolsforeign
KernSmoothrpartclassnnetspatialmgcvz^\s*(?P<name>[a-zA-Z0-9.+\-]{1,})(\s*\(\s*(?P<relop>[>=<]+)\s*(?P<version>[0-9a-zA-Z:\-+~.]+)\s*\))?(\s*\[(?P<archs>[\s!\w\-]+)\])?\s*$z
=~ linux.*z== linux-32z== linux-64z	== win-32z	== win-64z	== osx-64)linuxlinux32linux64win32win64osxc                    dS )NT )package_names    :lib/python3.11/site-packages/conda_build/skeletons/cran.pypackage_existsr^   9  s	     4    c                   |                      ddt          j                  }|                    ddd           |                    dd	d
           |                    ddd           |                    dd           |                    dd           |                    dd           |                    ddd           |                    dd           |                    ddd           |                    d d!           |                    d"d#d$d%&           |                    d'dd(d)*           |                    d+dd,           |                    d-dd.           |                    d/d0d1d2*           |                    d3d0d4d5*           |                    d6dd7d8*           |                    d9dd:           |                    d;d<d=d>d?@           |                    dAdBt	          j        dCd           dD           |                    dEddFdGH           |                    dIddFdJH           d S )KNcranz
    Create recipe skeleton for packages hosted on the Comprehensive R Archive
    Network (CRAN) (cran.r-project.org).
        )helpformatter_classpackages+z-CRAN packages to create recipe skeletons for.)nargsrb   z--output-dirz5Directory to write recipes to (default: %(default)s)..)rb   defaultz--output-suffixzLSuffix to add to recipe dir, can contain other dirs (eg: -feedstock/recipe). z--add-maintainerz@Add this github username as a maintainer if not already present.)rb   z	--versionz(Version to use. Applies to all packages.z	--git-tagz"Git tag to use for GitHub recipes.z
--all-urls
store_truez`Look at all URLs, not just source URLs. Use this if it can't
                find the right URL.)actionrb   z
--cran-urlz+URL to use for as source package repositoryz
--r-interpr-basezDeclare R interpreter package)rh   rb   z--use-binaries-verzURepackage binaries from version provided by argument instead of building from source.z--use-when-no-binary)srcoldzsrc-oldold-srcerrorrm   a  Sometimes binaries are not available at the correct version for
                a given platform (macOS). You can use this flag to specify what
                fallback to take, either compiling from source or using an older
                binary or trying one then the other.)choicesrh   rb   z--use-noarch-genericuse_noarch_genericz?Mark packages that do not need compilation as `noarch: generic`)rk   destrb   z--use-rtools-winz/Use Rtools when building from source on Windowsz--recursivez=Create recipes for dependencies if they do not already exist.z--no-recursivestore_false	recursivezCDon't create recipes for dependencies if they do not already exist.z--no-archivearchivez&Don't include an Archive download url.z--allow-archivedallow_archivedz>If the package has been archived, download the latest version.z--version-comparezCompare the package version of the recipe with the one available
        on CRAN. Exits 1 if a newer version is available and 0 otherwise.z--update-policystore)rp   skip-up-to-dateskip-existing	overwritezmerge-keep-build-nummerge-incr-build-numrp   a  Dictates what to do when existing packages are encountered in the
        output directory (set by --output-dir). In the present implementation, the
        merge options avoid overwriting bld.bat and build.sh and only manage copying
        across patches, and the `build/{number,script_env}` fields. When the version
        changes, both merge options reset `build/number` to 0. When the version does
        not change they either keep the old `build/number` or else increase it by one.)rk   rq   rh   rb   z-mz--variant-config-filesskeleton_config_yamlz}Variant config file to add.  These yaml files can contain
        keys such as `cran_mirror`.  Only one can be provided here.z--add-cross-r-baseFz:Add cross-r-base to build requirements for cross compiling)rk   rh   rb   z--no-commentsz5Do not include instructional comments in recipe files)
add_parserargparseArgumentDefaultsHelpFormatteradd_argumentr   get)reposra   s     r]   r~   r~   B  s    !>   D 	@    
 	D    
 	[    
 	O     	7     	1     	'     	:     	,    
 	     	=8	     	!N	     	>    
 	L    
 	R	     	5	     	M	     	M     	
 Z    & 	 "#94@@G	     	M	     	H	      r_   c                    i }| D ]j}|s	 d|v r|                     dd          \  }}n|                     dd          \  }}n'# t          $ r t          j        d|z             Y nw xY w|||<   k| |d<   |S )N:    :z$Error: Could not parse metadata (%s)
orig_lines)split
ValueErrorsysexit)linesdlinekvs        r]   dict_from_cran_linesr     s    
A   			Dt||D!,,AA
 C++A 	D 	D 	DH;dBCCCCC	D! AlOHs   7A!A'&A'c                   d}d}d}d}d}|                      d           t          |           D ]m\  }}|                    |          rBd|                                z   }|r|sJ ||z  }d| |<   Bd}|dz
  }| |         |z   }d}d| |<   \|r|sJ || |<   d}d}d}n|rd | D             } |                      d           | S )	aw  
    >>> chunk = [
        'Package: A3',
        'Version: 0.9.2',
        'Depends: R (>= 2.15.0), xtable, pbapply',
        'Suggests: randomForest, e1071',
        'Imports: MASS, R.methodsS3 (>= 1.5.2), R.oo (>= 1.15.8), R.utils (>=',
        '        1.27.1), matrixStats (>= 0.8.12), R.filesets (>= 2.3.0), ',
        '        sampleSelection, scatterplot3d, strucchange, systemfit',
        'License: GPL (>= 2)',
        'NeedsCompilation: no']
    >>> remove_package_line_continuations(chunk)
    ['Package: A3',
     'Version: 0.9.2',
     'Depends: R (>= 2.15.0), xtable, pbapply',
     'Suggests: randomForest, e1071',
     'Imports: MASS, R.methodsS3 (>= 1.5.2), R.oo (>= 1.15.8), R.utils (>= 1.27.1), matrixStats (>= 0.8.12), R.filesets (>= 2.3.0), sampleSelection, scatterplot3d, strucchange, systemfit, rgl,'
     'License: GPL (>= 2)',
     'NeedsCompilation: no']
    ) 	NFri   r   Tr   c                    g | ]}||S r[   r[   ).0cs     r]   
<listcomp>z5remove_package_line_continuations.<locals>.<listcomp>   s    '''qQ''''r_   )append	enumerate
startswithlstrip)chunkcontinuationcontinued_ixcontinued_linehad_continuationaccumulating_continuationsir   s           r]   !remove_package_line_continuationsr     s+   * LLN!&	LLU## $ $4??<(( 	$&D) 	 ''''$&a-1* 1u!&|!4t!;#' a) $''''&4l#-2*!%# (''E'''	LLLr_   c                    t          j        | dt                                        dd                              dd                              d          S )a  
    Quote a string for use in YAML.

    We can't just use yaml.dump because it adds ellipses to the end of the
    string, and it in general doesn't handle being placed inside an existing
    document very well.

    Note that this function is NOT general.
    T)indentDumperz
...
ri   
z
  z
 )yamldumpr   replacerstrip)strings    r]   yaml_quote_stringr   '  sF     		&j999	B			v				r_   c                    g }d}|                                  D ]9}|                                }|dk    r|dk    s|                    |           |}:d                    |          S )Nri   r   )
splitlinesr   r   r   )r   r   	last_liner   s       r]   clear_whitespacer   ;  sp    EI!!##  {{}}

yBLL		99Ur_   c                    |                                  }|                    dd          }t          |          }t          |                                          }t          |          S )Nutf-8r   )errors)readdecoder   r   r   r   )fpbytestextr   s       r]   read_description_contentsr   F  sV    GGIIE<<	<22DD!!D-doo.?.?@@E&&&r_   Tc                   |rt          d| z             t          |           dk    r9t          | d          5 }t          |          cd d d            S # 1 swxY w Y   nSt	          j        |           rt	          j        | d          5 }|D ]N}t          j        d|j                  r2|	                    |          }t          |          c cd d d            S O	 d d d            n# 1 swxY w Y   n| 
                    d          rt          j        | d          5 }|                                D ]O}t          j        d|j                  r3|                    |d          }t          |          c cd d d            S P	 d d d            n# 1 swxY w Y   nt          j        d| z             t          j        d| z             d S )	Nz Reading package metadata from %sDESCRIPTIONrbrz^[^/]+/DESCRIPTION$.zipz)Cannot extract a DESCRIPTION from file %sz;%s does not seem to be a CRAN package (no DESCRIPTION) file)printr	   openr   tarfile
is_tarfilerematchnameextractfileendswithzipfileZipFileinfolistfilenamer   r   )pathverboser   tfmemberzfs         r]   get_archive_metadatar   N  s    9047888~~&&$ 	1,R00	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1		D	!	! E\$$$ 	9 9 982FK@@ 9//B4R8888		9 	9 	9 	9 	9 	9 	9 	999	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9
 
v		 E_T3'' 	92++-- 9 982FODD 9--B4R8888		9 	9 	9 	9 	9 	9 	9 	999	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	<tCDDDHJTQRRRRRsC   AAA
AC)C))C-0C-AFFFFc                   t          j        g dt           j        t           j        | j                  }|                                \  }}|                    d          }|                    d          }|s|j        rt          j        d|z             |	                                
                                }|st          j        d           t          d|d         z             |d         S )N)gitzfor-each-refz	refs/tagsz--sort=-committerdatez--format=%(refname:short)z	--count=1stdoutstderrcwdr   zError: git tag failed (%s)zError: no tags foundzUsing tag %s)
subprocessPopenPIPEwork_dircommunicater   
returncoder   r   stripr   r   )configpr   r   tagss        r]   get_latest_git_tagr   e  s    	
 	
 	
 O	 	 	A ]]__NFF]]7##F]]7##F 8 8-6777<<>>$$&&D )'(((	.48
#$$$8Or_   c                 x    t          j        dd                                                                          dv S )zGets whether the SSL_NO_VERIFY environment variable is set to 1 or True.

    This provides a workaround for users in some corporate environments where
    MITM style proxies make it difficult to fetch data over HTTPS.
    SSL_NO_VERIFYri   )1true)r   r   r   lowerr[   r_   r]   _ssl_no_verifyr     s3     ;++113399;;}LLr_   c           	     "   t          j                    }t                      |_        	 dd l}dd l}|                    ||j                            t          | d                              }n!# t          $ r |rt          d           Y nw xY w|S )Nr   z
.web_cache)cachezRTip: install CacheControl and lockfile (conda packages) to cache the CRAN metadata)requestsSessionr   verifycachecontrolcachecontrol.cachesCacheControlcaches	FileCacher   ImportErrorr   )
output_dirr   sessionr   s       r]   get_sessionr     s      G#%%GN
"""" ++<.88j,9W9WXX , 
 
     	    Ns   A. .BBc                   |rt          d| d|             |                    | dz   |z   dz             }	 |                                 nF# t          j        j        $ r/}|j        j        dk    rt          d|z             g cY d }~S  d }~ww xY wg }t          j	        d|j
                  D ]z\  }}|                    d          r`d	|v r\|                    d
d          d                             d	d          \  }	}
|                    |                                |
f           {d t!          |d          D             S )Nz'Fetching archived versions for package  from /src/contrib/Archive//i  z#No archive directory for package %sz9<td><a href="([^"]+)">\1</a></td>\s*<td[^>]*>([^<]*)</td>.tar.gz_rg   r   r   r   c                    g | ]\  }}|S r[   r[   )r   dtr   s      r]   r   z-get_cran_archive_versions.<locals>.<listcomp>  s    :::%"aA:::r_   T)reverse)r   r   raise_for_statusr   
exceptions	HTTPErrorresponsestatus_coder   findallr   r   rsplitr   r   r   sorted)cran_urlr   packager   r   eversionsr   r  r   versions              r]   get_cran_archive_versionsr    sx    SQQQxQQRRRH66@3FGGA	(   :!S((7'ABBBIIIIII	
 HDaf  3 32 ::i   	3SAXXHHS!,,Q/55c1==MD'OORXXZZ1222::6(D999::::s#   A B #B
B	B

Bc                   |rt          d| z             |                    | dz             }|                                 i }t          j        d|j                  D ]g}|                    d          rPd|v rL|                    dd          d                             dd	          \  }}||f||	                                <   h|                    | d
z             }|                                 t          j        d|j                  D ]A}t          j
        d|          r*|                    |	                                |d f           B|S )NzFetching main index from %sz/src/contrib/z!<td><a href="([^"]+)">\1</a></td>r   r   rg   r   r   r   r   z#<td><a href="([^"]+)/">\1/</a></td>z	^[A-Za-z])r   r   r  r   r	  r   r   r
  r   r   r   
setdefault)r  r   r   r   recordsr   r   r  s           r]   get_cran_indexr    sK    8+h6777H.//AGZ<afEE 4 4::i   	4SAXXHHS!,,Q/55c1==MD'%)7OGDJJLL!H6677AZ>GG 5 58L!$$ 	5qwwyy1d)444Nr_   Fc                    g }	 |                      |g           }n	#  g }Y nxY w|s|r1|                    |                    d          d         dz              |D ] }|                    t           |            !|S )Nr   r   r   )	get_valuer   r   INDENT)mkeyallow_emptyresultold_valsold_vals         r]   
make_arrayr    s    F;;sB'' 0; 0ciinnR(3./// , ,***++++Ms    !c                   d }|r|dz   |                     dd          z   }t          t          | |                    rt          t          | |                    }nt          t          | ||z                       r!t          t          | ||z                       }nFt          t          | d|z   |z                       r#t          t          | d|z   |z                       }|S )N-r   r-)r   r   r   r   )r   output_suffixr  r  r  s        r]   existing_recipe_dirr$    s    F <C-'//#s";";;d:w''(( L$z73344	Z=!899	:	: L$z7]+BCCDD	Z-!?@@	A	A L$z4'>M+IJJKKMr_   c                `    |                      |          r| d t          |                    S | S N)r   len)r   ends     r]   	strip_endr)    s2    s #kS	k""Mr_   r  strc                   t          |          rdS t          d|z             t          |d          }t          |t                    }d|v rt          |d          }t	          |                                          }t          |d          }|rt          ||          }|                    d          r
|dd         }|                    d	          ru|                    d	d
          }t	          |          }t          j	        d|          
                    d                                          }t          | |d|z   |          }nt          |          rDt          || f          }	|	| k    rt          d| d|            |}t          | |d|z   |          }n0d|v r|}t          | |d|z   |          }nt          | |||          x}}|r	 t          |          }
n#  d}
Y nxY wd}
|}|r8|
r6d|vr2|
                    dd
          }d|v r|}|
                    dd          }|rd|                    dd          z   nd
}t#          | d|z   |z   |z             }t          d| d| d|            ||||
||dS )a  
    Converts `package` (*) into a tuple of:

    pkg_name (without leading 'r-')
    location (in a subdir of output_dir - may not exist - or at GitHub)
    old_git_rev (from existing metadata, so corresponds to the *old* version)
    metadata or None (if a recipe does *not* already exist)

    (*) `package` could be:
    1. A package name beginning (or not) with 'r-'
    2. A GitHub URL
    3. A file:// URL to a tarball
    4. A relative path to a recipe from output_dir
    5. An absolute path to a recipe (fatal unless in the output_dir hierarchy)
    6. Any of the above ending (or not) in sep or '/'

    So this function cleans all that up:

    Some packages may be from GitHub but we'd like the user not to have to worry
    about that on the command-line (for pre-existing recipes). Also, we may want
    to get version information from them (or existing metadata to merge) so lets
    load *all* existing recipes (later we will add or replace this metadata with
    any that we create).
    NzParsing input package %s:r   
github.comz.gitz
-feedstockr"  r   zfile://ri   z	(.*)_(.*)r   zpackage z/ specified with abs path outside of output-dir zsource/git_urlzsource/git_revr!  r   z	.. name: z location: z new_location: )pkg-namelocationzold-git-revold-metadatanew-locationr  )r   r   r)  r   r	   r   r   r   r   r   groupr$  r   r
   RuntimeErrorr   r  r   )r   r#  git_tagr  r  pkg_namer.  pkg_filenameexisting_locationcommpr  old_git_revgit_urlvstrnew_locations                  r]   package_to_inputs_dictr<    s+   6 g t	
%
/000%%G%%GwGV,,  &&((H<00H 6X}554    ABB<)$$ 
??9b11))8L,77==a@@FFHH/th
 
 
w 
gz233J_7__S]__   /th
 
 
	 	 /th
 
 (;w(
 (
 	
$  	*++AA	AAA K >A >,h66++.337""H++&6==K.5=3c****2D
D8Od$:]$JKKL	
Rh
R
R8
R
RL
R
RSSS "$  s   G G%c                   | dz   |d         z   }t          j        |          }|                                 |d         }t          j        d|j                  D ]}}|                    |          rf|                    d          \  }}}|                    |          \  }}}|d                             |g           	                    |||z   f           ~d S )Nr   dirextz<a href="([^"]*)">\1</a>r   binaries)
r   r   r  r   r	  r   r   
rpartitionr  r   )	r  detailsurlr  r?  r   pkgr   vers	            r]   get_available_binariesrF  H  s    
S.75>
)C|C  H
%.CJ:HMJJ R RS!! 	R"--c22KCCs++ICAJ**333::Cx;PQQQ	R Rr_   c                    t          j        d          |                     d          }fd|D             }d                    |          S )Nz^\s*#\sr   c                >    g | ]}                     |          |S r[   )r   )r   r   
re_comments     r]   r   z#remove_comments.<locals>.<listcomp>W  s,    NNN$z7G7G7M7MNNNNr_   )r   compiler   r   )templater   lines_no_commentsrI  s      @r]   remove_commentsrM  T  sP    J''JNN4  ENNNN%NNN99&'''r_   rg   ri   rl   rm   use_when_no_binary,Literal['error' | 'src' | 'old' | 'old-src']c                5  o |dk    r9|dk    r3|dk    r-|dk    r't          d| d           t          j        d           t          |          }t	          ||          }|r%|s#t          d	           t          j        d           |spt                      5 }t          ||          d
         }d d d            n# 1 swxY w Y   t          |                    dt          d                             d
         }t          |           dk    r|	rt          d          |
dk    r| st          d          i }g }|                    d          }d }ddddddd| dd|rdndddd| dd|rdnddd}|                                D ]4\  }}t                      |d<   |dk    r|d         rt          ||           5| D ]6}t!          |||||          }|r|                    |d         d |ii           7|                                D ]\  }} |                    |           |r||                                         d          }!|!d!         }"|!d         }#|!d"         }|"od#|"v }$|"o"t)          |"          ot+          j        |"          }%d}&|!d!         }'|!d$         }(t          d%|#            |%rt/          |"          })nc|$s|%rt1          |j                   t5          j        dd&|"ii|'          }*t9          j        |*                    d          |*j        j         |*j        j                   |r|ntC          |          }+tE          j#        d(d)|+gtD          j$        tD          j$        |j        *          },|,%                                \  }-}.|-&                    d+          }-|.&                    d+          }.|,j'        r-t          j        d,|+ d-|.(                                 d.           |-rt          |-t          j)        /           |.rt          |.t          j*        /           tW          |j        d0          }/t)          |/          stW          |j        d1d0          }0tW          |j        |",                    d          d2         d0          }1t)          |0          r|0}/n/t)          |1          r|1}/nt          j        |" d3|0 d4|1 d5           t/          |/          })nB|t[          |          }2t]          ||2          }|#/                                |vrt          j        d6|#z             ||#/                                         \  }}3|3r|r||3k    r|3}n|r-|s+t          d7| d8| d9           t          j        d           n|s+|3s)|s't          d:|#z             t          j        d           nld}&ta          ||2|          }4|3r|3g|4z   }4|s	|4d
         }nF||4vrBd7| d8| d;}5t          |5d4+                    |4          z              t          j        d           d })|)|)d<         }|)d=         }|/                                }6||#         oo                    ||d>|6z   |1                    d?d@          dAd
dAdAdAdBdAdBdAdAdAdC           |	r%t          j         |	|(odD                               g }7g }8g }9d
}:|
2                    dE          r|!dF         rx|!dF         }*tg          |*dG          }7tg          |*dH          }8tg          |*dI|          }9|*4                                odD         k    r!|*5                                }:|:|
dJk    rdnd
z  }:|rDtl           | };|;|9vr5t          |9          stg          i dId          }9|9                    |;           t          |9          r2|9dd          7                                 |98                    d
dK           dA+                    |9          odL<   dA+                    |7          odM<   dA+                    |8          odN<   |:odO<   d }<ts          j:        |          }=i }>d }?|=                                D ]\  }}dA}@odP         |dP<   odD         |dD<   |&r|dk    r|dQxx         dR|z   dz   z  cc<   |dk    rdn0||d         v o&tw          ofdS|d         |         D                       }A|As|dk    r$t          dT           t          j        d           n|2                    d          r||d         vr@|<                    d          rd}Ad|d<   t          dU           t          j        d           |d         |         d2         d         |dV<   |d         |         d2         d
         |dD<   |dD         1                    d@d?          |dP<   d}Ad }<t{          j>                    }B|d         r|Ar|%r&t          |"          }Ct          |"|(          }@|@x}D}E|"}<n|$r|dk    rdWA                    ||dP         |dX                   }F| dY|dX         z   }CdZA                    |dQ                   }@|d[A                    |dQ                   z   }D|D|Fz   }Et          d\| d]|E            	 t9          jB        |jC        dA|E|d?z   |Fz   d^          \  }<}Gn.#  t          d_|E d`           t          j        d           Y nxY w|?|dk    r|<}?i }H|da         |Hda<   |dP         |HdP<   |dD         |HdD<   |<rh|B                    t          |<db          E                                           |E|dV<   |C|Hdc<   |@|Hdd<   |D|Hde<   df|BF                                 |Hdg<   |<|Hdh<   |dk    rW|$r0dA|Hdi<   dj|Hdk<   dl|Hdm<   dn}I|I|Hdg<   dA|Hdc<   dA|HdV<   |'|Hd&<   |+|Hdo<   dA|Hdp<   n0dq|Hdi<   dA|Hdk<   dA|Hdm<   dr|@z   |Cz   |HdV<   dA|Hd&<   dA|Hdo<   n|dV         |HdV<   odM         |HdM<   |H|>|<   g ds}J|Jd d          }Kd}L|>                                D ]M\  }}|dk    r |                                D ]
\  }M}N|No|M<   +|da         }O|KG                    |O           |Ldz  }LN|K|Jk    rdA}Pdt}Qdu}Rnedvdw+                    |K          z   dxz   }Pdvdw+                    dy |KD                       z   dxz   }Qdvdw+                    dz |KD                       z   dxz   }Rd{}S|Pod|<   |Qod}<   |Rod~<   |Kod<   d|>v r|>d         }H|P|Hd<   |Hdc         }Cdd|Hv rV|Hdd         }@|r>|%rtl          |@z   |HdV<   n<|&s+tl          |@z   |Cz   |Pz   tl          z   |@z   dR| dz   |Cz   |Pz   |HdV<   ndr|@z   |Cz   |Pz   |HdV<   |$s djA        di |H|Hdp<   |)t/          |?          })d+                    d |)d         D                       od<   d}LdAxod<   od<   |>                                D ]\  }}|dk    r)t          jA        di |od<   t          jA        di |od<   4dv|da         z   dxz   |d<   t          jA        di |odt          |L          z   <   t          jA        di |odt          |L          z   <   |Ldz  }Lt          |)                    dd          t                    }T|T\  od<   od<   od<   d|)v rodxx         dz  cc<   |)                    d          dk    rodxx         dz  cc<   d|)v r!dAod<   drt          |)d                   z   od<   ndAod<   |$r	dr|" od<   nd| od<   |r|)                    dd          dk    rdAod<   ndod<   d|)v r dAod<   drt          |)d                   z   od<   d|)v r|sd|)d         z  od<   ndAod<   d |)                    ddA          ,                    d          D             }Ud |)                    ddA          ,                    d          D             }Vd |)                    ddA          ,                    d          D             }Wi }Xt                      }Yt          t          |V|U|W                    D ]}Zt          S                    |Z          }[|[st          j        d| d|Z            |[T                    d          }\|\|Yv rR|YU                    |\           |[T                    d          }]|[T                    d          pdA}^|[T                    d"          pdA}_|_1                    d?d@          }_|^r|_sJ |]rt          j        d| d|Z            |^ |_ |X|\<   d|XvrdA|Xd<   |)                    ddA          }`|`dk    r!|`dk    r|`dAk    rt          d|` d           dA}`|`dk    r
dod<   dAod<   |`dk    r
dod<   dAod<   |`dAk    r|rdAod<   n|`dAk    rdod<   |$}a|)                    dd          dk    rt+          jD        |>d         dh                   5 }btw          d |bD                       }c|crdntw          d |bD                       }dtw          d |bD                       }etw          d |bD                       }ftw          |f|c|e|df          rdntw          d |bD                       }gd d d            n# 1 swxY w Y   n
dx}dx}ex}cx}f}gd|Xv sd|Xv rd}e|erd}ddD ]$}hg }i|hdk    r|dr>|i                    tl           d|R            |i                    tl           d|Q            |er>|i                    tl           d|R            |i                    tl           d|Q            |cr>|i                    tl           d|R            |i                    tl           d|Q            |r)dx}dx}ex}cx}f}g|i                    tl           d|Q            |fs|gs|ar|i                    tl           d|Q            |ar|i                    tl           d˝           |fr|i                    tl           d|Q            |i                    tl           d|Q            |i                    tl           d|P            |i                    tl           d|R            |i                    tl           d|Q            |i                    tl           dѝ           |gr_|i                    tl           d|P            |fs|i                    tl           d|Q            |i                    tl           d|Q            |i                    tl           d|Q            |r|i                    tl           d|S            n+|hdk    r%|ds|es|cr|i                    tl           d|Q            |hdk    s|hdk    r:t          |X          D ])}\|\t          v r|\dk    r |i8                    d
tl           |            3d>|\/                                z   }j|X|\         r(|i                    tl           |j dr|X|\                     n|i                    tl           |j            |r|\/                                }k|k|vrwt!          ||||kd           }|k|d         k    s$J d٠A                    |\|d                               |k|vsJ |                    |kd |ii           |                    |k           +dA+                    |i          od|hz  <   &||r(t          t                    aYt          t                    aZ|D ]}||         ood          d$         }(t          |(          r0|	s.|
dk    rt          d|(z            |
dk    rt1          |(           nZ|
dk    r?|t[          |          }2t]          ||2          }t          |od          dF                   rn|
dk    rod          dF         rod         }ld߄ o                                D             o	 t          tW          |(                     n#  Y nxY wt          d|/                                z             t          tW          |(d          d          5 }m|m_                    t          t          jA        di o                     d d d            n# 1 swxY w Y   t          tW          |(d                    r|
dk    rt          tW          |(d          d          5 }m|l|Jk    r8|m_                    t          jA        di oa                    d+                     n|lg k    r8|m_                    t          jA        di oa                    d+                     ned |lD             }nd+                    d |nD                       od<   |m_                    t          jA        di oa                    d+                     d d d            n# 1 swxY w Y   t          tW          |(d                    r|
dk    rt          tW          |(d          d          5 }mt          d |lD                       dk    rL|m_                    t          jA        di o1                    dd          a                    d+                     nK|m_                    t          jA        di o1                    dd          a                    d+                     d d d            n# 1 swxY w Y   d S )Nrp   rm   rn   ro   zERROR: --use_when_no_binary=z not yet implementedr   )variant_config_filesz1ERROR: --no-archive and --allow-archived conflictr   cran_mirrorz7--version-compare only works with one package at a timez%At least one package must be suppliedr   z{others}zsrc/contrib/r   T)selectorr>  r?  use_thisrX   zbin/windows/contrib/r   FrY   zbin/macosx/el-capitan/contrib/z.tgz)r   zwin-64zosx-64r@  r   rT  r-  inputsr.  r  r,  r0  zMaking/refreshing recipe for r9  )r   r   checkoutr   r   zError: 'git checkout z
' failed (z).
Invalid tag?)filer   rD  r   zA does not appear to be a valid R package (no DESCRIPTION file in z, )zPackage %s not foundzERROR: Version z of package z+ is archived, but --no-archive was selectedzRERROR: Package %s is archived; to build, use --allow-archived or a --version valuez" not found.
  Available versions: r/   r3   r"  r!  r   ri   #)cran_packagenamecran_versionpackagenameconda_versionpatchesbuild_numberbuild_dependshost_dependsrun_dependshome_commenthomeurlsummary_commentsummarybinary1binary2r]  merger/  zsource/patcheszbuild/script_envzextra/recipe-maintainersr|   z	extra:
  extra_recipe_maintainersr^  
script_envr_  r[  r>  zArchive/c              3  6   K   | ]\  }}d          |k    V  dS )r[  Nr[   )r   r   r   r   s      r]   	<genexpr>zskeletonize.<locals>.<genexpr>h  sE        1 n%*     r_   z=ERROR: --use-when-no-binary is error (and there is no binary)zfERROR: No binary nor old binary found (maybe pass --use-when-no-binary=old-src to fallback to source?)cranurlz{}_{}{}r?  z_{{ version }}z{{{{ cran_mirror }}}}/{}z/{}zDownloading r   )rC  fnzlogic error, file z4 should exist, we found it in a dir listing earlier.rS  r   r   contrib_urlcontrib_url_renderedzsha256: 
hash_entrycached_pathurl_keyzgit_url:git_url_keyzgit_tag:git_tag_keyz=# You can add a hash for the file here, (md5, sha1 or sha256)r3  archive_keyszurl:r   )rT   rW   rX   rY   z	  # [win]z  # [not win]z  # [z or ]c              3  D   K   | ]}|                     d           |V  dS winNr   r   fss     r]   rm  zskeletonize.<locals>.<genexpr>  s3      OOR"--:N:NObOOOOOOr_   c              3  D   K   | ]}|                     d           |V  dS rz  r|  r}  s     r]   rm  zskeletonize.<locals>.<genexpr>  s3      SSRbmmE>R>RSbSSSSSSr_   z'  # [build_platform != target_platform]sel_srcsel_src_and_winsel_src_not_winfrom_sourceselz/{url_key}{sel}    {cranurl}
  {hash_entry}{sel}r   c                    g | ]	}|d |z  
S )z# %sr[   )r   r   s     r]   r   zskeletonize.<locals>.<listcomp>  s!    JJJtTJVd]JJJr_   r   cran_metadataversion_binary1version_binary2version_sourcebinaryversion_binaryr(   Nonelicenselicense_filelicense_familyr)   z (FOSS)r*   yesz (Restricts use)URLrc  rd  z$ https://CRAN.R-project.org/package=r-   nonoarch_genericznoarch: genericDescriptionre  rf  r2   z# Suggests: %ssuggestsc                ^    g | ]*}|                                 |                                 +S r[   r   r   ss     r]   r   zskeletonize.<locals>.<listcomp>V  =     
 
 
QWWYY
GGII
 
 
r_   r%   ,c                ^    g | ]*}|                                 |                                 +S r[   r  r  s     r]   r   zskeletonize.<locals>.<listcomp>Y  r  r_   r'   c                ^    g | ]*}|                                 |                                 +S r[   r  r  s     r]   r   zskeletonize.<locals>.<listcomp>\  s=     
 
 
qwwyy
GGII
 
 
r_   r+   z+Could not parse version from dependency of r   r   archsrelopz:Don't know how to handle archs from dependency of package Rr.   unixwindowszUnknown OS_type: z in CRAN packagezskip: True  # [not unix]skip_oszskip: True  # [not win]z	# no skipc                f    g | ].}|j                                                             d           /S ))z.fz.f90z.f77z.f95z.f03r   r   r   r   fs     r]   r   zskeletonize.<locals>.<listcomp>  sA        //0VWW  r_   c                f    g | ].}|j                                                             d           /S )z.cr  r  s     r]   r   zskeletonize.<locals>.<listcomp>  s0    ,W,W,WqQV\\^^-D-DT-J-J,W,W,Wr_   c                f    g | ].}|j                                                             d           /S ))z.cxxz.cppz.ccz.c++r  r  s     r]   r   zskeletonize.<locals>.<listcomp>  sA        //0OPP  r_   c                f    g | ].}|j                                                             d           /S )z
/configurer  r  s     r]   r   zskeletonize.<locals>.<listcomp>  s0    GGGqQV\\^^,,\::GGGr_   c                f    g | ].}|j                                                             d           /S ))z	/makefilez	/makevarsr  r  s     r]   r   zskeletonize.<locals>.<listcomp>  sA        ! FLLNN334NOO  r_   RcppRcppArmadillo)buildhostrunr  z{{ compiler('c') }}            z{{ compiler('m2w64_c') }}      z{{ compiler('cxx') }}          z{{ compiler('m2w64_cxx') }}    z{{ compiler('fortran') }}      z{{ compiler('m2w64_fortran') }}zrtools                   z{{ posix }}filesystem      z{{ posix }}gitz{{ posix }}sed             z{{ posix }}grep            z{{ posix }}autoconf        z{{ posix }}automake        z{{ posix }}automake-wrapperz{{ posix }}pkg-configz{{ posix }}make            z{{ posix }}coreutils       z{{ posix }}zip             zcross-r-base {{ r_base }}  r  z{{native}}gcc-libs       r  z%name {} != inputs_dict['pkg-name'] {}z
%s_dependsz=directory already exists (and --update-policy is 'error'): %sr{   ry   rz   c           	         i | ]N\  }}|t          j        d t          |                                        dd                                          OS )NFKDasciiignore)unicodedata	normalizer*  encoder   )r   r   r   s      r]   
<dictcomp>zskeletonize.<locals>.<dictcomp>A  s]     
 
 
1 {$VSVV44;;GXNNUUWW
 
 
r_   zWriting recipe for %sz	meta.yamlwzbuild.shwbc                (    g | ]}t           |         S r[   ) target_platform_bash_test_by_sel)r   ts     r]   r   zskeletonize.<locals>.<listcomp>S  s    VVVA<Q?VVVr_   z || c                    g | ]
}d |z   dz   S )z[[ ${target_platform} z ]]r[   r  s     r]   r   zskeletonize.<locals>.<listcomp>U  s#    LLL!1A5=LLLr_   source_pf_bashzbld.batc                <    g | ]}|                     d           |S )r{  r|  r}  s     r]   r   zskeletonize.<locals>.<listcomp>[  s)    JJJrR]]55I5IJJJJr_   r   z
r[   )fr   r   r   r   r   r   r"   r   r   r!   r'  r   r   itemsdictrF  r<  updater   popr   r   r   r   r    r   r   fromdictr   
git_sourceget_sectionr   	git_cacher   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r   r   r  r  r_  r  sortinsertcopydeepcopyanyr   hashlibsha256r	   r   formatdownload_to_cache	src_cacher   r   	hexdigestremoveSOURCE_METAVERSION_METABINARY_METAr*  get_license_infor   r   setlistr   VERSION_DEPENDENCY_REGEXr   r1  addr  R_BASE_PACKAGE_NAMESrM  CRAN_BUILD_SH_SOURCE	CRAN_METAr   r2  
up_to_dater   writer   r  CRAN_BUILD_SH_BINARYCRAN_BUILD_SH_MIXEDCRAN_BLD_BAT_SOURCECRAN_BLD_BAT_MIXED)pin_packagesr   r#  add_maintainerr  r3  r  ru   rv   version_compareupdate_policyr_interpuse_binaries_verrr   rN  use_rtools_winr   rQ  rw   add_cross_r_baseno_commentsr  _variantpackage_dictspackage_list
cran_indexcran_layout_templatearchive_typearchive_detailsr  inputs_dictr\   package_dictrU  r.  r4  is_github_urlr   
is_archiverC  dir_pathcran_packager  new_git_tagr   r   r   r   sub_description_pkgsub_description_namer   r[  all_versionsmsgplowerr^  rk  rj  r_  new_maintainerrs  cran_layout	availabledescription_pathrp  available_artefactr  r   rq  package_urlfilename_renderedr   available_detailshash_msg_allr  	binary_idr   r   r  r  r  r  	sel_crosslicense_infodependsimportslinksdep_dictseenr  r   r   r  r  rE  os_typeneed_gitr   need_fneed_cneed_cxxneed_autotools	need_makedep_typedeps
conda_name
lower_namefrom_sourcesr  tpbtr   sp                                                                                                                  @r]   skeletonizer!  [  s$   0 	g%%%''%'')++U-?UUUVVV *%%J >RSSSF g ABBB !! 	:Q+Av66q9H	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:LL(8(GHH
 

 ;!RSSS@AAAMLs##H J #! 
 
  =*:=== 0;e	
 
 G4DGGG 0;e	
 
 0 *>)C)C)E)E > >%o&*ff
#8##
(C#"8_=== U U,w
 
  	U  +j"9Hk;R!STTT&3&9&9&;&; * *"lL))))
 d	7|//1128<*%*%# =\X%=S&"2"2Sw7I(7S7S

Z .)8h88999  L	 /99LL I	 j I	 &/"""!8i-B"CFSSSAh'');QX=N   &-L''2DV2L2LK 
K0!!O	  A ]]__NFF]]7++F]]7++F| #K # #6<<>> # # #    /f3:.... /f3:....v>>K+&& &*6?E=&Q&Q#'+OX^^C%8%8%<m( ($ -.. "5KK011 "6KKH# b b3Fb bJ^b b b   0<<LL !%j11+Hg>>
~~z11/(:;;;$.x~~/?/?$@!G\  W  <0G0G&    ogoo7ooo     \  .  h   !
87GTT A$0>L#@L  *1oGGL00mGmmmmmC#		, 7 77888HQKKKL#"9-G"9-G(#	$+ '#f}!(c!:!: !!# "! ##&# 	
 	
 	
,  	HH1_3EFFFGGG
#% ##G,, 		T1G 		T~&A $455G#A'9::J'1-~( ($ yy{{a000 ~~//]6L%L%LRSS 	@ &888N%===344 /960 0, )//???'(( 	=$QRR(--///$++A|<<<(*0H(I(I
$%www'')''*--,(.m$899	-8->->-@-@ w	< w	<)L/K./.?ON+/0/AOO, Elh66&&&*w*>*DD&&&  8++ 
 ;;      /
 ;G D    	  & .%00W   HQKKKK'22599 .oj&AAA-66u== 	(16.:?OJ7$!!c    HQKKK1@1LW1U22OI. 8Gz7R888OO4 7F'7gc3'' $N3 *.&K^%%Fz* H</A H< !7'11H")(H"="=K9DD(;"*KK& 7,(*B*B(1(8(8!@/RWBX) )% #*===PU@VVH"<"C"C'.# #K ,4ell'.7 7 ,( #79J"JKJJJ[JJKKK$)/)A",'2&2S&8;L&L * *QQ$rrrr   '/<83K3K+6($&!0?
0K!*-4CN4S!.15D_5U!/2 CMM${D"9"9">">"@"@AAA1<OI.4<%j17B%m4@T%&<=6UAQAQASAS6U6U%l37B%m4  8++$ :79))4;E)-8;E)-8#b:B),78:)*579))47:))47B))4<>).997=))4;=)-8;=)-87:[7H87S))479))479))443B93M%i0/0|!),*;	,' 211111g	-6__->-> 	 	)L/x''+1133  DAqAaDD &j1""3'''Q		$G)O-OOK 8 883>G++OO;OOOOOP  ++SS;SSSSST 
 >	).
.
&-y   )( 3'.e$(4H 111/> ! 7=7K))44' ")*&' && %	%
 ** 43334 '' && *)4 k)H4w> &i0 ! .5F5. 5.,5. 5.!.1
 /0@AAL!YYJJ|L'AJJJ
 
/
 	688
q!23-6__->-> 
	 
	)L/x'')0CC?CC(&2&9&L&LO&L&L"##)0?:3N)NQT)T&/:/A/T/TO/T/T(S^^+,7C7J 8 8%8 8"S^^34 Q		'Y//1I
 
 @L<)a'+;)<,,iLLLI%LLL344==iLLL..LLLL   "An!2<3F!G!GGAiLL !#An P-8~~)OgOO) #	4 2D99UBB"$A"3AL((#%A !2<3N!O!OOAiL%%k%,|J/GGAjMMAjM
 
+//	2>>DDSII
 
 

 
+//	2>>DDSII
 
 

 
+//R@@FFsKK
 
 
 uueGWe4455 	- 	-A,22155E WUwUURSUUVVV;;v&&Dt||HHTNNNKK((EKK((.BE++i((.BC++c3''C#### .&. .*+. .  
 !&_s__HTNNhHSM""9b11fI!5!5'R--?g???@@@Gf5AiL"$Ai4AiL"$Ab==[=AiLL]]&AiL .55>>i1-@AA R !#    #XDD,W,WTV,W,W,W(X(X   !#    "%GGBGGG" "
 NFHfEFFDD %'    )              > GLKFKXKK)XH!<!<H 	F0 o	7 o	7HD7"" KK!WWoWW   KK!WWoWW    KK!WWoWW   KK!WWoWW    KK!WWoWW   KK!WWoWW   " WNSSFSXSS)KK6 U UO U UVVV " Y ( KK!SS/SS    ?KK6 = = =>>>! FKK!SS/SS   KK!SS/SS   KK6 S S' S STTTKK!SS/SS   KK!SS/SS   KK6 D D DEEE KK6 S S' S STTT) %WWoWW   KK!SS/SS   vWWoWWXXX# WKK6 U U) U UVVVU"" X  KK!QQQQ   6!!X%6%6"8,, $@ $@D333 s{{ A&'<('<'<====%)DJJLL%8
#D> A KK6(P:(P(P(P(PQQQQ KK6(?:(?(?@@@$ @)-J)>>.D$.w
TX/" /" %/+j2I$I$I$I#J#Q#Q$(+j*A$" $" %J$I$I (2'E'E'E'E - 4 4%/(K1H$I!" !" !" !- 3 3J ? ? ?)+AlX%&&I  d	7L  /./CDD#I..	  ; ;'"X;~.( 	O 	''";=EF   +--h///!%j11+Hg>>
*ak.&ABB o--!H+n2M-'
 
		
 
 
	T(^^$$$$	D%7888$x--s33 	=qGG$Y%5%:%:%:%:;;<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=d8Z0011 	M]k5Q5Qd8Z00$77 
M14''GG07<<!<<CCGLLMMMM!R''GG07<<!<<CCGLLMMMMVVVVVD*0++LLtLLL+ +A&' GG/6;;;;BB7KKLLL
M 
M 
M 
M 
M 
M 
M 
M 
M 
M 
M 
M 
M 
M 
M d8Y//00 	M[4P4Pd8Y//66 !JJ\JJJKKqPPGG+277Q77 v..    GG*166A66 v..                _; ;s   B;;B?B?'j//)kGBAJJAJJAJ_A_2_2A_6`;2Aa9a9Aa=	b Aa=	cC"Af4f4Af8	f;Af8	h B5AkkAk	kAk	
recipe_dirc                    t          |           }|                                }t          |           }t          d| d| d           t          d| d| d           ||k    S )NzLocal recipe for z has version rg   zThe version on CRAN for z is )r   r  r	   r   )r"  newest_conda_versionr  local_versionr  s        r]   r  r  i  sz    AIIKKMz""G	
Dg
D
DM
D
D
DEEE	
IW
I
I2F
I
I
IJJJ000r_   r[   c                   g }t          |           }|D ]}|                    d          rt          |          s'|dd          }|r	||v s||v s<||vrt          d|z             St	          t          | |          ||         d                             dd                     t          d|z             |                    |           |S )Nr"  r   zSkipping %s, not found on CRANr   r!  r   zUpdating %s)r   r   r   r   r  r   r   r   )r   r  rd   	to_updaterecipesreciperecipe_names          r]   get_outdatedr+  u  s   Ij!!G & &  && 	eFmm 	QRRj 	[H44(8J8Jj((2V;<<<V$$j&=a&@&H&Hc&R&R	
 	
 	
 	mf$%%%%%%%r_   c                    g }t          |           }|D ]Q}|                    d          rt          |          s'|dd          }|r	||v s||v s<|                    |           R|S )Nr"  r   )r   r   r   r   )r   r  rd   existingr(  r)  r*  s          r]   get_existingr.    s    Hj!!G 	% 	%  && 	eFmm 	QRRj 	[H44(8J8J$$$$Or_   c                    |\  }}}}|dd          }|sdS d|v rdS || vrdS | |         \  }}|r|                                 |k    rdS dS )Nr   Fr,  T)r  )	r  r  
r_pkg_namer.  r8  r  cran_pkg_namer   r  s	            r]   r  r    s    +2(J+qqrrNM  u xu
**5}-MD' 199;;'))u4r_   c                d   g dddgg dg dddgdd	gg d
g dg ddgd
}d}g }g }d t          j        d|           D             }|D ]}|                    d          r|                    |dd                    5|                                D ]Z}|||         v rN||         d         }	|                    |	           |                    |                    |	                      n[d                    |          p| } d}
|rdt          |d           d}
t          | |          }| |
|fS )a  
    Most R packages on CRAN do not include a license file. Instead, to avoid
    duplication, R base ships with common software licenses:

    complete: AGPL-3, Artistic-2.0, GPL-2, GPL-3, LGPL-2, LGPL-2.1, LGPL-3
    template: BSD_2_clause BSD_3_clause, MIT

    The complete licenses can be included in conda binaries by pointing to the
    license file shipped with R base. The template files are more complicated
    because they would need to be combined with the license information provided
    by the package authors. In this case, the template file and the license
    information file are both packaged. All optional ('|' seperated) licenses
    are included, if they are matching.

    This function returns the path to the license file for the unambiguous
    cases.
    )zAGPL-3zAGPL (>= 3)AGPLz!GNU Affero General Public LicensezArtistic-2.0zArtistic License 2.0)zGPL-2z
GPL (>= 2)z!GNU General Public License (>= 2))zGPL-3z
GPL (>= 3)z!GNU General Public License (>= 3)GPLzGNU General Public LicensezLGPL-2zLGPL (>= 2)zLGPL-2.1zLGPL (>= 2.1))zLGPL-3zLGPL (>= 3)LGPLz!GNU Lesser General Public License)BSD_2_clauseBSD_2_ClausezBSD 2-clause License)BSD_3_clauseBSD_3_ClausezBSD 3-clause LicenseMIT)
agpl3	artistic2gpl2gpl3lgpl2lgpl21lgpl3bsd2bsd3mitz?'{{{{ environ["PREFIX"] }}}}/lib/R/share/licenses/{license_id}'c                6    g | ]}|                                 S r[   r  )r   l_opts     r]   r   z$get_license_info.<locals>.<listcomp>  s     VVVE%++--VVVr_   z\||\+zfile    Nr   )
license_idz | ri   zlicense_file:   )r   r   )	r   r   r   r   keysr  r   r   r   )license_textr   	d_licenselicense_file_templatelicense_textslicense_fileslicense_text_partsrF  rH  
l_opt_textr  r  s               r]   r  r    s   , XWW$&<=LLL
 
 
 M*/WWWHHHHHHw! I( 	L  MM WVRXh5U5UVVV#  G$$ 	  qrr+++ $..** 	 	J	*---&z215
$$Z000$$)00J0GG    . ::m,,<L L MLxa'H'H'HLLL *,8PQQN~55r_   )T)Fr&  )r  r*  )rg   ri   NNNNFTFri   rl   NFrm   FNNFFF)rN  rO  )r"  r*  )r[   )b__doc__
__future__r   r   r  r  r   r   r   r   r  r   	itertoolsr   osr   r   r   r   os.pathr	   r
   r   r   r   r   r   r   r   r   typingr   r   r   r   r   r   conda.common.ior   ri   r   conda_interfacer   r   r   r   r  r   r   metadatar   rD   r   r    variantsr!   r"   r  r  r  r  r  r  r  r  r  r  	CRAN_KEYSr  R_RECOMMENDED_PACKAGE_NAMESrJ  r  r  r^   r~   r   r   r   r   r   r   r   r   r   r  r  r  r$  r)  r<  rF  rM  r!  r  r+  r.  r  r  r[   r_   r]   <module>r^     s    # " " " " "    				     



             . . . . . . . . . . . .                                .......        % $ $ $ $ $       @ @ @ @ @ @ @ @ ( ( ( ( ( ( K K K K K K K K       & & & & & & & & = = = = = = = =
/B	H 2+ Z  
  
  	4 " & &2:,   $ $    Q Q Qh  ,8 8 8v  (  ' ' 'S S S S.  :M M M   &; ; ; ;*   $
 
 
 

 
 
   ?C` ` ` ` `F	R 	R 	R( ( ( GL+K K K K K\	1 	1 	1 	1   4   "  ,M6 M6 M6 M6 M6s   &A- -A;:A;