
    xhe                     `   d 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mZ ddlmZ ddlmZ ddlmZmZmZmZ ddlZddlmZ dd	lmZmZmZmZmZmZmZmZ dd
l m!Z!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z+ dZ,dZ-dZ.g Z/ G d de0          Z1 G d de          Z2d Z3d Z4d Z5d Z6d Z7d2dZ8d Z9d Z:d Z;	 	 	 	 	 	 	 d3d"Z< ed#          d$             Z=d% Z> ed#          d&             Z?d' Z@d( ZAd) ZBd* ZCd+ ZDd, ZE ed#          d-             ZFd. ZGd/ ZHd0 ZId1 ZJdS )4z6
Tools for converting CPAN packages to conda recipes.
    N)	lru_cachepartial)glob)makedirs)basenamedirnameexistsjoin   )environ)
CondaErrorCondaHTTPError	MatchSpecResolveTemporaryDirectoryTmpDownloaddownload	get_index)Configget_or_merge_config)check_call_envon_linuxon_win)get_default_variant)_parsea  {{% set name = "{packagename}" %}}
{{% set version = "{version}" %}}
{{% set sha256 = "{sha256}" %}}

package:
  name: {{{{ name }}}}
  version: {{{{ version }}}}

{source_comment}source:
  {useurl}url: {cpanurl}
  {usesha256}sha256: {{{{ sha256 }}}}

# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
build:
  number: 0
  run_exports:
    weak:
      - {{{{ name }}}} ={{{{ version }}}}

requirements:
  build:{build_depends}

  # Run exports are used now
  host:
    - perl{host_depends}

  run:
    - perl{run_depends}

{import_comment}test:
  # Perl 'use' tests
  {import_comment}imports:{import_tests}

  # You can also put a file called run_test.pl (or run_test.py) in the recipe
  # that will be run at test time.

about:
  home: {homeurl}
  license: {license}
  summary: {summary}

# See
# https://docs.conda.io/projects/conda-build for
# more information about meta.yaml
a  #!/bin/bash

set -o errexit -o pipefail

# If it has Build.PL use that, otherwise use Makefile.PL
if [[ -f Build.PL ]]; then
    perl Build.PL
    perl ./Build
    perl ./Build test
    # Make sure this goes in site
    perl ./Build install --installdirs site
elif [[ -f Makefile.PL ]]; then
    # Make sure this goes in site
    perl Makefile.PL INSTALLDIRS=site
    make
    make test
    make install
else
    echo 'Unable to find Build.PL or Makefile.PL. You need to modify build.sh.'
    exit 1
fi

# 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.
aG  :: If it has Build.PL use that, otherwise use Makefile.PL
IF exist Build.PL (
    perl Build.PL
    IF %ERRORLEVEL% NEQ 0 exit /B 1
    Build
    IF %ERRORLEVEL% NEQ 0 exit /B 1
    Build test
    :: Make sure this goes in site
    Build install --installdirs site
    IF %ERRORLEVEL% NEQ 0 exit /B 1
) ELSE IF exist Makefile.PL (
    :: Make sure this goes in site
    perl Makefile.PL INSTALLDIRS=site
    IF %ERRORLEVEL% NEQ 0 exit /B 1
    make
    IF %ERRORLEVEL% NEQ 0 exit /B 1
    make test
    IF %ERRORLEVEL% NEQ 0 exit /B 1
    make install
) ELSE (
    ECHO 'Unable to find Build.PL or Makefile.PL. You need to modify bld.bat.'
    exit 1
)

:: 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.
c                       e Zd ZdZdS )InvalidReleaseErrorzR
    An exception that is raised when a release is not available on MetaCPAN.
    N)__name__
__module____qualname____doc__     :lib/python3.11/site-packages/conda_build/skeletons/cpan.pyr   r      s          	Dr#   r   c                       e Zd ZdZd ZdS )PerlTmpDownloadz_
    Subclass Conda's TmpDownload to replace : in download filenames.
    Critical on win.
    c           	         d| j         vrd | _        | j         S d| j         v r#| j                             d          }|d         }nt          | j                   }|                    dd          }t          j                    | _        t          j        	                    d          }t          |dd	t          | j                                       dd                    }t          ||          }|                    dd          }t          |          }t          |          st          |           t          ||| j         f
          }t          t          j                            |                    s,t          t          j                            |                     t          |          st          | j         |           |S )Nz://	CHECKSUMSzid/   ::-~.conda-buildcpan)	cache_dirfilename_prefixother_hashed)urltmp_dirsplitr   replacetempfilemkdtempospath
expanduserr
   r   r	   r   get_pickle_file_pathr   )selfturlfilenamehomebase_dirdsts         r$   	__enter__zPerlTmpDownload.__enter__   s     DL8Odh&&x~~e,,7#DH--''c22H#+--DL7%%c**Dnfhtx.@.@.H.Hs.S.S H x**C++dC((Cs||H(## #"""&"HDH;  C "'//#..// /--...#;; (3'''Jr#   N)r   r   r    r!   rB   r"   r#   r$   r&   r&      s-         
" " " " "r#   r&   c                    dd l }ddlm} |                    |d| |d          \  }}g }|                    |          5 }t          d |D                       }	|	rdnt          d |D                       }
t          d	 |D                       }t          d
 |D                       }t          ||	||
f          rdnt          d |D                       }|
s|s|	r|                    d           |r|                    d           |	r|                    d           |rT|                    d           |                    d           |                    d           |                    d           |r*|                    d           |                    d           d d d            n# 1 swxY w Y   t          dt          j	        
                    |            d|            |S )Nr   r   )source )r2   sha256c                 f    g | ].}|j                                                             d           /S ))z.fz.f90z.f77z.f95z.f03namelowerendswith.0fs     r$   
<listcomp>z;get_build_dependencies_from_src_archive.<locals>.<listcomp>   sA        ''(NOO  r#   Tc                 f    g | ].}|j                                                             d           /S ))z.cz.xsrH   rL   s     r$   rO   z;get_build_dependencies_from_src_archive.<locals>.<listcomp>   s0    IIIafllnn--m<<IIIr#   c                 f    g | ].}|j                                                             d           /S ))z.cxxz.cppz.ccz.c++rH   rL   s     r$   rO   z;get_build_dependencies_from_src_archive.<locals>.<listcomp>   s1    RRR!QV\\^^$$%DEERRRr#   c                 f    g | ].}|j                                                             d           /S )z
/configurerH   rL   s     r$   rO   z;get_build_dependencies_from_src_archive.<locals>.<listcomp>   s0    PPPafllnn55lCCPPPr#   c                 f    g | ].}|j                                                             d           /S ))z	/makefilez	/makevarsrH   rL   s     r$   rO   z;get_build_dependencies_from_src_archive.<locals>.<listcomp>   s1    VVVaafllnn--.HIIVVVr#   z{{ compiler('c') }}z{{ compiler('cxx') }}z{{ compiler('fortran') }}zautoconf  # [not win]zautomake  # [not win]zm2-autoconf  # [win]zm2-automake-wrapper  # [win]zmake  # [not win]zm2-make  # [win]zINFO :: For z%, we need the following build tools:
)tarfilerE   rD   download_to_cacheopenanyappendprintr8   r9   r   )package_urlrF   	src_cacherT   rD   cached_path_resulttfneed_fneed_cneed_cxxneed_autotools	need_makes                 r$   'get_build_dependencies_from_src_archivere      s   NNN--2{f== NK F	k	"	" #.b   
 
 KDDIIbIIIJJ 	
 RRrRRR
 
 PPRPPPQQ NFHf=>>XDDVVSUVVVWW 	
  	1X 	1 	1MM/000 	3MM1222 	7MM5666 	:MM1222MM1222MM0111MM8999 	.MM-...MM,---G#. #. #. #. #. #. #. #. #. #. #. #. #. #. #.H 
drw''44dd\bdd   Ms   E"F--F14F1c                 T    t          t          t          |                               S )N)strparse_version)vers    r$   loose_versionrj      s    }SXX&&'''r#   c                 (   |s|                      dd          } t          |           5 }	 t          j        |          5 }|                                }d d d            n# 1 swxY w Y   t          |d          r|                    d          }t          j        |          }nW# t          $ r= t          j        t          j        |d                                                    }Y nt          $ r d }Y nw xY wd d d            n# 1 swxY w Y   |S )Nr*   r+   decode	utf-8-sigutf-8)encoding)r5   r&   gziprV   readhasattrrl   jsonloadsOSErrorcodecsr   )r2   colons	json_pathdist_json_fileoutputrel_dicts         r$   get_cpan_api_urlr|     s    %kk$$$			 
		9%% /',,../ / / / / / / / / / / / / / /vx(( 4{33z&))HH 	S 	S 	Sz&+i'"J"J"J"O"O"Q"QRRHHH 	 	 	HHH	
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Osd   DB$AB$A#	#B$&A#	'<B$#D$AC8(D*C85D7C88DDDc                     	 dd| g}t           rB|                    dd           |                    dd           |                    dd           t          |           d}n# t          j        $ r d}Y nw xY w|S )	Nr.   z-Dr   z/cz/dzcmd.exeTF)r   insertr   
subprocessCalledProcessError)package_namecmdin_repos      r$   package_existsr     s    	t\* 	%JJq$JJq$JJq)$$$s(   Ns   AA" "A65A6c                 ~   t          j                    }t          | d          5 }	 |                    d          }|sn|                    |           .	 d d d            n# 1 swxY w Y   |D ]<}|                    t          |d          r|                    d          n|           =|                                S )NrbTi   encodern   )hashlibmd5rV   rq   updaterr   r   	hexdigest)r>   r1   sha1rN   dataothers         r$   md5d_file_and_otherr   #  s   ;==D	h		 	66%==D KK		 	                R RWUH-E-EPELL)))5QQQQ>>s   0A!!A%(A%r"   c                     dt          t          |          dd         z   }t          j                            | |                    dd          dz   |z   dz             S )Nhr   
   r*   r+   .z.p)r   __file__r8   r9   r
   r5   )r/   r0   r1   r   s       r$   r;   r;   0  sV    !(L99!B$??A7<<	?#:#:4#E#E#Ka#ORV#VWWWr#   c                 D   t          || |z             }t          |          rft          |d          5 }t          j        |          }|r(|r&||k    r t          j        |          cd d d            S d d d            n# 1 swxY w Y    |            }	 t          j        t
          j                            |                     n#  Y nxY wt          |d          5 }t          j	        ||           t          j	        ||           d d d            n# 1 swxY w Y   |S )N)r/   r0   r   wb)
r;   r	   rV   pickleloadr8   r   r9   r   dump)r0   base_folderdata_partialkeypickledrN   
key_storedr^   s           r$   load_or_pickler   5  s    #/D  G
 g &'4   	&AQJ &z &cZ&7&7{1~~	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& \^^F
BGOOG,,----	gt		 CFA               Ms/   2A??BB1C C+DDDc           	      |   	 t                      }t          rd}nt          rd}nd}t                      5 }t	          j        |d|  gd||d                    t          |g|dd          R   d	d
g}t          j        |d          	                    d          
                    dd                              d          }|cd d d            S # 1 swxY w Y   na# t          $ rT}t          d                    | d                    |                               t          |j                   Y d }~nd }~ww xY wg S )N)zwin-64Librarybinzperl.exe)zlinux-64r   perl)zosx-64r   r   zperl=hostr   )envconfigsubdirr)   z-ezuse Module::CoreList; my @modules = grep {Module::CoreList::is_core($_)} Module::CoreList->find_modules(qr/.*/); print join "
", @modules;F)shellrn   z

zHFailed to query perl={} for core modules list, attempted command was:
{} )r   r   r   r   r   
create_envr
   r   check_outputrl   r5   r4   	ExceptionrY   formatmessage)versionr   subdirstmpdirargsall_core_moduleses          r$   install_perl_get_core_modulesr   N  s   & 	0>GG 	01GG/G!! 	$V"""#qz    ----/-D 'E:::&&t	  $+	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$,    W^^$ 	
 	
 	

 	ai Is<   2C BCC CC CC 
D9%A
D44D9c                 N    t          d|t          t          |           |           S )Nzperl-core-modules)r   r   r   )r   r   r   )r   r/   s     r$   &get_core_modules_for_this_perl_versionr   z  s0    :GDD	   r#   r   https://fastapi.metacpan.org/v1Fc                    t          |          }t          j                            |j        dd          }|j                            dt          |          d                   }	t          |	|          }
|		                    dd          }	i }d}d}t                      }|}g }| D ]}d}|                    ||f           |} | r|                                 \  }}d	|v r|                    d	          \  }}}n|}||v r?|                    |           |}t          |||
|r|n|          }|dk    rt!          d
| d           |||	                    dd          hvrt!          d
| d| d| d           t#          |||
|r|n||          }t%          |          }|
|dz   |z   |v s|dz   |d         z   |v r|                    ||ddddddddddd          }||}n t#          |||
|t)          |                    }t          |||d                   }t+          ||          r)|st!          d|z             d|d<   d|d<   d|d<   d}nt-          |||||||
          \  }}d|d<   d|d<   |                    d          rs|d         |d<   t/          |d                   \  |d<   }t!          d                    |d         ||                     t3          |d         |d         |j                  }ng }d|d<   d|d<   d|d<   |d xx         |                    dg|z             z  cc<   |d!xx         |                    dgt7          |d"         d#         |d$         d#         z            z             z  cc<   |d%xx         |                    dgt7          |d$         d#                   z             z  cc<   |D ]3}|| vr|                     |           t!           d&j        |            4d'}d}t9          |          r|st!          d(|z             dt9          |          r|rt!          d)|z             	 |d*         d+         |d,<   n# t:          $ r d-|z   |d,<   Y nw xY wd.|v r-t=          |d.                                       d/          } | |d0<   	 tA          |d1         t6                    r|d1         d2         n|d1         |d1<   n# t:          $ r d3|d1<   Y nw xY w|d         |d<   |                    |dz   |d         z              |	                    dd          !                    d          d2         }!d4|v rQtE          t          |d4                             D ].}"|"#                    |!          rd5|"vr|d6xx         ||"z   z  cc<   /|d6         rd|d7<   nd|d7<   t9          |          stI          |           t!          d8                    ||d                              tK          t          |d9          d:          5 }#|#&                    tO          j        dAi |(                    d;                     ddd           n# 1 swxY w Y   tK          t          |d<          d:          5 }#|r|#&                    d=           n7|#&                    tS          j        dAi |(                    d;                     ddd           n# 1 swxY w Y   tK          t          |d>          d?          5 }#|r|#&                    d@           n$|#&                    tU          j        dAi |           ddd           n# 1 swxY w Y   | dS dS )BzS
    Loops over packages, outputting conda recipes converted from CPAN metata.
    r-   z
pickled.cbr   z.*rE   z
    - z
    #- N=	WARNING: zj is a Perl core module that is not developed outside of Perl, so we are skipping creating a recipe for it.r*   r+   z was part of the z- distribution, so we are making a recipe for z	 instead.r   z# z'')packagenamebuild_dependshost_dependsrun_dependsbuild_commenttest_commands	usesha256useurlsource_commentsummaryimport_testsz2We found core module %s. Skipping recipe creation.#r   r   r   T)release_data
output_dirr/   meta_cpan_url	recursivecore_modulescpanurlrF   download_urlzUsing url {} ({}) for {}.r   r   buildnoncorerunr   z/INFO :: Already building package {} (module {})Fz?Directory %s already exists and you have not specified --force z8Directory %s already exists, but forcing recipe creation	resourceshomepagehomeurlzhttp://metacpan.org/pod/abstractur   licenser   perl_5providesz::_r   import_commentzWriting recipe for {}-{}z	meta.yamlr   rn   zbuild.shs"   #!/bin/bash
echo "Nothing to do."
zbld.batwzecho "Nothing to do."
r"   )+r   r8   r9   r
   src_cache_rootvariantgetr   r   r5   setrX   pop	partitionadddist_for_modulerY   get_release_infoperl_to_conda
setdefaultrh   metacpan_api_is_core_versiondeps_for_packageget_checksum_and_sizer   re   r[   listr	   KeyErrorreprlstrip
isinstancer4   sorted
startswithr   rV   write	CPAN_METAr   CPAN_BUILD_SHCPAN_BLD_BAT)$packagesr   r   r   r   forcer   
write_corer/   perl_versionr   package_dictsindentindent_coreprocessed_packagesorig_versionnew_packagespackagemoduler]   orig_packagelatest_release_datar   dr   dir_pathempty_recipedepspackages_to_appendsizesrc_build_dependspkgr   module_prefixprovided_modrN   s$                                       r$   skeletonizer    sD
    !((FV2NLQQI >%%f.A&.I.I&.QRRL9,	RRL  ''b11LMFKLL 	/ 	/ Wf-....H
 Q2",,.. '>>")"3"3C"8"8GQ"G (((w''' !9lf4QFF'
 
 fL     
 \<+?+?c+J+JKKK:L : :7 : :'.: : :  
 /.FF,
 
 $G,, #g-2DDD3!4Y!??DVVV$$*!# "!!%!#"$ " 
 
$ ?.LL+y,wAWAW L
 
Ki1HII (w?? =	! H;V   AhK AkN"%ALL (8)%#+#)( ( ($D$ AiLAhK// *+N;)$9,~:V$W$W!(T1889tWUUVVV$K 0!H+v?O% %!! %'!!(!$+&)"#o&++rd5F.F"G"GG
 ntDM)4tE{97MMNNN" "  m 0 0"T%[=S8T8T1T U UU *  h&&OOC((((PIPRUV    !L ( 	YE 	YQ   H 	Y% 	YLxWXXX	@'4Z@AiLL 	@ 	@ 	@5?AiLLL	@%%<
344;;C@@G"AiL	$ l95t<<-Y'**!), iLL
  	$ 	$ 	$#AiLLL	$#I.){S01Y<?@@@  c2288==a@%% &s<
+C'D'D E E ? ?**=99 ?e<>W>Wn%%%,)>>%%%^ 	'"$A"&Ah 	X 	(//Qy\JJKKK$x--t44 	;GGI$))q))0099:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;$x,,d33 	Cq C?@@@@,11q1188AABBB		C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C
 $x++S11 	2Q 212222+00a00111		2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2[  Q2 Q2 Q2 Q2 Q2s[   
Q Q10Q1&4S S-,S-8YY #Y A[!![%([%
=]]])maxsizec                 D    | dS | |dv s| t          |          k    rdS dS )NF)NrE   T)rh   )core_versionr   s     r$   is_core_versionr    s:    u		!	J		LM'4J4J$J$Jtur#   c                    |                      dd          }|                    ddd           |                    dd	d
           |                    dd           |                    ddd           |                    ddd           |                    ddd           |                    ddd           d S )Nr.   zy
    Create recipe skeleton for packages hosted on the Comprehensive Perl Archive
    Network (CPAN) (cpan.org).
        )helpr   +z-CPAN packages to create recipe skeletons for.)nargsr  z--output-dirz5Directory to write recipes to (default: %(default)s).r   )r  defaultz	--versionz(Version to use. Applies to all packages.z--meta-cpan-urlr   zBURL to use for MetaCPAN API. It must include a version, such as v1)r  r  z--recursive
store_truezTCreate recipes for dependencies if they do not already exist (default: %(default)s).)actionr  z--forcez;Force overwrite of existing recipes (default: %(default)s).z--write_corez<Write recipes for perl core modules (default: %(default)s). )
add_parseradd_argument)reposr.   s     r$   r  r    sC      D 	<    
 	D    
 	7     	1Q    
 	c    
 	J    
 	K      r#   c                     t          t                                }	 t          |                    t	          |                               }n	#  d}Y nxY w|rt          |d         j                  }nd}|S )zO
    :returns: the latest version of the specified conda package available
    N)r   r   r   get_pkgsr   rh   r   )r  rpkg_listpkg_versions       r$   latest_pkg_versionr#    sv    
 		A!**Ys^^4455 #HRL$899s   /A Ac                 	   t                      t                      dt                      t                      dt                      t                      dd}ddddddd}t                      }	t          d| z  d	
           t          j                                         |                    d          s||	fS g }
|d         D ]{}d|v r5|d         dk    r)t          d                    |d                              ;d|v r|d         dk    rd|d<   nd|v r|d         dk    rd|d<   |
                    |           ||
|d<   |d         D ]b}	 |d         dk    r9||d                  s d|v r|d         dk    rt          d           t          dd	
           t          j                                         t          ||||d                   }t          |          }|
                                dk    r|d         dv rd|d<   t          |d                   }	 t          ||||d         |           n8# t          $ r+ t          d| d|  d| d           t          d          }Y nw xY wt          |          t          d          k    rt          |          }|t!          ||d                   }	 |.t          |          t          |          k    r|d |d         z   z  }nk# t"          $ r^ t          d!           t          d"                    |d                              t          d#|            t          d$|            Y nw xY w|rd |v rit%          t'          ||                    d%d&                              s7|	                    d'                    ||d         f          |d                    n=t-          t'          ||d(z                       s|	                    ||d         f           t/          ||d                   }||d                  }|rF|r"||         d)                             |           nK||         d*                             |           n)t          d+                    |d         |                     L# t0          t2          f$ r Y `w xY wt          d,|  d-|	            ||	fS ).a  
    Build the sets of dependencies and packages we need recipes for. This should
    only be called for non-core modules/distributions, as dependencies are
    ignored for core modules.

    :param package: Perl distribution we're checking dependencies of.
    :type package: str
    :param release_data: The metadata about the current release of the package.
    :type release_data: dict
    :param perl_version: The target version of Perl we're building this for.
                         This only really matters for core modules.
    :type perl_version: str
    :param output_dir: The output directory to write recipes to
    :type output_dir: str
    :param processed_packages: The set of packages we have built recipes for
                               already.

    :returns: Build dependencies, runtime dependencies, and set of packages to
              add to list of recipes to create.
    :rtype: 3-tuple of sets
    )corer   )r   testr   r   r&  r   N)r   	configurer&  runtimex_Dist_Zilladevelopz!Processing dependencies for %s...rE   )end
dependencyphaser*  zSkipping develop dependency {}r  FindBinzFindBin::BinExporterrelationshiprequireszcommon::sensez$debug common::sense version mismatchr   r   r   >   rE   undef0zWARNING: The version of z listed as a dependency for z, zS, is not available on MetaCPAN, so we are just assuming the latest version is okay.r   z6We have got an expected error with dependency versionsz	Module {}zPkg_version zDep Version r*   r+   r   z-[v1-9][0-9.]*r%  r   zSkipping {} dependency {}zmodule z adds )r   rY   sysstdoutflushr   r   rX   r   r   rJ   rh   r   r   rj   r#  metacpan_api_get_core_versionr   r	   r
   r5   r   r   r   r   r   )r   r   r   r/   r   r   r   r  phase_to_dep_typer  new_depsdepdep_dict	orig_dist	dep_entrydep_versionr"  r%  cb_phases                      r$   r   r     s   6 %%CEE2235511#%%00 D    	
-
7R@@@@JL)) (''' HL)  c>>c'li77299#h-HHIII__X)!;!;*CMM__X*!<!<&CM!)L . h hf	':55('):; x''HX,>/,Q,Q@AAAcr""""
  """+!9lHX<N 	 *)44	??$$.. I&-77*-HY'+HY,?@@5$%!$ *#    + 5 5 5!9 ! !*1! !5@! ! !   #0"4"4KKK5 !--c0B0BBB"4Y"?"?K"*
 'D((8*<' '	<&2)+66{9S9SSS%x	/B)BBI$ < < <VWWWk00(1CDDEEE:[::;;;:[::;;;;;	<  	Pi''%d:y7H7Hs7S7S&T&TUU .22!$9hy6I*J!K!K ( 2   "$zI@P4P"R"RSS P*..	8H;M/NOOO 4M8HCUVV,Xg->?  AXv.229====Xy155i@@@@3::8G;LiXX   N+ 	 	 	H	 

7G
7
7#5
7
7888###sj   R-BR;$R H:9R:2I/,R.I//A
R:0K+*R+A%MRMERR.-R.c                 t   d|v rt          d           d}	 t          ||          }|d         }nk#  t          | ||          }|Q|d         |                    dd          k    r)t          d                    ||d                              |d         }Y nxY w|st          d           |s
J d	            |S )
z]
    Given a name that could be a module or a distribution, return the
    distribution.
    z
Git::Checkz
debug thisNdistributionr*   r+   z-WARNING :: module {} found in distribution {}debugzdist_for_module must succeed)rY   core_module_dictrelease_module_dictr5   r   )cpan_urlr/   r   r  rA  mod_dictr{   s          r$   r   r   y  s    
 vl L4#L&99/
4&xFCC'6>>$+D+DDDCJJ 8   
 $N3L g777777s
   0 A&Bc           
         d|v rt          d|            n-d|v rt          d|            nd|v rt          d|            	 |  d| }t          d|            t          |d          }n# t          $ r d }Y nt          $ r d }Y nw xY w|st          d	|            |                    d
d          }|rd|vr]|rd|v r	|d         }nt          d| d           	 |  d| }t          |d          }|}n1# t          $ r d }Y n#t          $ r d }Y nw xY wt          d|            |rd|vrt          d| d| d| d|            |S )NzDist-Zilla-Plugin-Gitzdebug zDist::Zilla::Plugin::Gitz
Time::Zone/module/zINFO :: url_module Trw   z,WARNING :: Did not find rel_dict for module r*   r+   r,  rA  z%WARNING :: 'distribution' was not in z's module info, making it up	/release/Fz)INFO :: OK, found 'dependency' in module z,WARNING :: No dependencies found for module z in distribution z
WARNING :: Please check z and )rY   r|   RuntimeErrorr   r5   )rE  r/   r  
url_moduler{   rA  url_release	rel_dict2s           r$   release_module_dict_directrO    si   &((v    	#v	-	-v    			v    22&22
0J00111#Jt<<<       GEVEEFFF>>$,,L D|833 	(22#N3LL\\\\  	%>>>>K(UCCCI HH 	 	 	HHH 	 	 	HHH	 	B&BBCCC 
|833F6 F FT` F F'1F F8CF F	
 	
 	
 Os0   *A1 1B?BB#C> >DDDc                    d|v rt          d           t          | ||          }|st          ||dz             }|  d| }	 t          j        t          j                            |                     n#  Y nxY wt          ||           t          |d          5 }|	                                }d d d            n# 1 swxY w Y   t          |d          r|                    d          }t          j        |          }|d                             |d	                   r8t          d
|            |d                             d|d	         z   d          }	nt          d|            t          j                            |t#          |d                             }
t          |d         |
           t%          j        |
          5 }|	                                }d d d            n# 1 swxY w Y   t          | ||	          }|S )NzRegexp-CommonrB  z.dl_urlz/download_url/r   rl   rm   releaser   zUp to date: r+   rE   zNot up to date: r   )rY   rO  r;   r8   r   r9   r   r   rV   rq   rr   rl   rs   rt   rK   r5   r
   r   rp   )rE  r/   r  r{   r   r2   dl_url_jsonrz   dl_url_dictdistrA   ry   s               r$   rD  rD    s~   &  g)(IvFFH (M 'y&92DEE1111	K001111	Dg'4   	(K %%''F	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(68$$ 	0]];//Fj((y!**;y+ABB 	M)))***y)11#I8N2NPRSSDD -V--... ',,y(;~3N*O*OPPC[0#6663 />',,../ / / / / / / / / / / / / / / 2(ItLLHOs0   1A5 5A9B==CC	G**G.1G.c                     d|v rt          d           d|v rt          d           	 t          |  d| d          }ddi}n6# t          $ r)}t          j        d	| d
|j                    Y d }~nd }~ww xY w|S )Nr.  rB  r/  rH  TrI  rA  r   z3Error: Could not find module or distribution named z on MetaCPAN. Error was: )rY   r|   r   r4  exitr   )rE  r  rF  r   s       r$   core_module_dict_oldrW    s    FgVg	,#x$A$A$A$A$OOO #F+  
 
 
== =12= =	
 	
 	
 	
 	
 	
 	
 	

 Os   A 
A6A11A6c                     || v rddiS d S )NrA  r   r"   )r   r  s     r$   rC  rC    s    ''4r#   c                 &   d|v rt          d           |  d| }|                    dd          }t          j        |          }|j        dk    rdS |  d| }t          j        |          }|j        dk    rd	S t          j        d
|z             d S )Nr.  rB  rJ  r*   r+      FrH  TzBError: Could not find module or distribution named %s on MetaCPAN.)rY   r5   requestsr   status_coder4  rV  )rE  r  r2   reqs       r$   r   r     s    Fg
(
(
(
(C
++dC
 
 C
,s

C
#u++6++l3?c!!4H' 	    r#   c                 v    t          | |          }	 |d         d         d         }n# t          $ r d }Y nw xY w|S )Nr  r  r   )rC  r   )r   r  module_dictr   s       r$   r7  r7  '  sW    "<88Kh'+I6    Ns   ' 66c                    |}t          | |||          }	 t          |  d| d          }t          |d                                       d          |d<   nj# t          $ r] t          | |          }|1|||k    r)t          d| d           t          |          d	d
gi d}nt          j        d|z             Y nw xY wd}|t          |          }	t          |d                   }
t          t          |	                    }	 |duo?t          d          t          |	          k    ot          |
          t          |	          k    }n# t          $ r}t          d           t          |           t          d|            t          d|            t          d                    |d                              t          d|            Y d}~nd}~ww xY w|r't          d|            t          d|	 d|
            |S )z
    Return a dictionary of the JSON information stored at cpan.metacpan.org
    corresponding to the given package/dist/module.
    rJ  FrI  r   vNr   z is not available on MetaCPAN, but it's a core module, so we do not actually need the source file, and are omitting the URL and MD5 from the recipe entirely.rE   r   )r   r   r   r,  z=Error: Could not find any versions of package %s on MetaCPAN.r3  z<We have some strange version mismatches. Please investigate.zPackage zVersion zPkg Version {}zLoose Version zWARNING :: Version mismatch in zWARNING :: Version: z, RelVersion: )r   r|   rg   r   r   r   rY   r4  rV  rh   rj   r   r   )rE  r/   r   r   r   r  r{   r  version_mismatchversion_strrel_version	loose_strr   s                r$   r   r   1  s    Lh	<IIG#x$C$C'$C$CERRR!(9"566==cBB   3HgFF#W=T=TL      |,, "$: 	 HH HU!  !* 'll(9-..k2233		0 't 3  c""mK&@&@@ M!+..-2L2LL 
  	0 	0 	0PQQQ!HHH&W&&'''&W&&'''"))(9*=>>???.9..////////	0  O999:::M[MMMMNNNOs-   AA A$B?>B?AE 
GA<GGc                    t          |           }t          |           }t          |dz             5 }t          |          5 }d}d}d}|D ]}|                                }|                    d|z             rd}1|r|                    d          r/|                    d          d                             d	          }w|                    d
          r0|                    d          d                             d	          } n|                    d          r nddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ||fS )z
    Looks in the CHECKSUMS file in the same directory as the file specified
    at download_url and returns the sha256 hash and file size.
    z
/CHECKSUMSFN'Tz'sha256'z=>r)   z', z'size})r   r   r&   rV   stripr   r4   )	r   base_urlr>   checksum_pathchecksum_file
found_filerF   r	  lines	            r$   r   r   r  s   
 |$$H%%H	L0	1	1 ]-   	MJFD%  zz||??3>22 
!%JJ z22 !%D!1!1!!4!:!:5!A!A11 #zz$//288??-- !	 	 	 	 	 	 	 	 	 	 	 	 	 	 	              $ 4<s6   ECD*E*D.	.E1D.	2EEEc                 X    d|                      dd                                          z   S )z>Sanitizes a Perl package name for use as a conda package name.zperl-r*   r+   )r5   rJ   )rI   s    r$   r   r     s'    T\\$,,224444r#   )r"   )r   Nr   FFNF)Kr!   rv   rp   r   rs   r8   r   r   r4  r6   	functoolsr   r   r   r   os.pathr   r   r	   r
   r[  rE   r   conda_interfacer   r   r   r   r   r   r   r   r   r   r   utilsr   r   r   variantsr   r   r   rh   r   r   r   	perl_corerK  r   r&   re   rj   r|   r   r   r;   r   r   r   r  r  r  r#  r   r   rO  rD  rW  rC  r   r7  r   r   r   r"   r#   r$   <module>rv     s        				      



  ( ( ( ( ( ( ( (             3 3 3 3 3 3 3 3 3 3 3 3       	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 1 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 * * * * * * - - - - - -.	`<@ 		 	 	 	 	, 	 	 	) ) ) ) )k ) ) )X0 0 0f( ( (  $  
 
 
X X X X
  2) ) )X   3
y2 y2 y2 y2x 4  ) ) )X 4   m$ m$ m$`  >) ) )X. . .b  &   4  0  > > >B  85 5 5 5 5r#   