
    -Ph                        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m	Z	 ddl
mZ ddlmZ ddlmZ dZd	 Z G d
 de	          Z eed          s3 ej        ej                  d             Zej        e_        ee_        dS dS )a  :mod:`sassutils.distutils` --- :mod:`setuptools`/:mod:`distutils` integration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module provides extensions (and some magical monkey-patches, sorry)
of the standard :mod:`distutils` and :mod:`setuptools` (now it's named
Distribute) for libsass.

To use this, add ``libsass`` into ``setup_requires`` (not ``install_requires``)
option of the :file:`setup.py` script::

    from setuptools import setup

    setup(
        # ...,
        setup_requires=['libsass >= 0.6.0']
    )

It will adds :class:`build_sass` command to the :file:`setup.py` script:

.. sourcecode:: console

   $ python setup.py build_sass

This commands builds Sass/SCSS files to compiled CSS files of the project
and makes the package archive (made by :class:`~distutils.command.sdist.sdist`,
:class:`~distutils.command.bdist.bdist`, and so on) to include these compiled
CSS files.

To set the directory of Sass/SCSS source files and the directory to
store compiled CSS files, specify ``sass_manifests`` option::

    from setuptools import find_packages, setup

    setup(
        name='YourPackage',
        packages=find_packages(),
        sass_manifests={
            'your.webapp': ('static/sass', 'static/css')
        },
        setup_requires=['libsass >= 0.6.0']
    )

The option should be a mapping of package names to pairs of paths, e.g.::

    {
        'package': ('static/sass', 'static/css'),
        'package.name': ('static/scss', 'static')
    }

The option can also be a mapping of package names to manifest dictionaries::

    {
        'package': {
            'sass_path': 'static/sass',
            'css_path': 'static/css',
            'strip_extension': True,
        },
    }

.. versionadded:: 0.15.0
    Added ``strip_extension`` so ``a.scss`` is compiled to ``a.css`` instead
    of ``a.scss.css``.  This option will default to ``True`` in the future.

.. versionadded:: 0.6.0
   Added ``--output-style``/``-s`` option to :class:`build_sass` command.

    N)Command)sdist   )Manifest)OUTPUT_STYLES)
build_sassvalidate_manifestsc                     	 t          j        |           dS # t          $ r3 t          j                            |dz   t          |          z             w xY w)zkVerifies that ``value`` is an expected mapping of package to
    :class:`sassutils.builder.Manifest`.

    zmust be a mapping object like: {'package.name': sassutils.distutils.Manifest('sass/path')}, or as shorten form: {'package.name': ('sass/path', 'css/path'}), not N)r   normalize_manifests	TypeError	distutilserrorsDistutilsSetupErrorrepr)distattrvalues      S/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sassutils/distutils.pyr	   r	   U   ss    

$U+++++ 
 
 
22 @ @ KK
 
 	

s	    =Ac                   f    e Zd ZdZeZdddd                    e          z   fgZd Zd Z	d Z
d	 Zd
S )r   z$Builds Sass/SCSS files to CSS files.zoutput-style=sz4Coding style of the compiled result.  Choose one of z, c                 "    d | _         d| _        d S )Nnested)package_diroutput_style)selfs    r   initialize_optionszbuild_sass.initialize_optionsq   s    $    c                     i | _         | j        j         rRi | _         | j        j                                         D ].\  }}t          j                            |          | j         |<   -d S d S N)r   distributionitemsr   utilconvert_path)r   namepaths      r   finalize_optionszbuild_sass.finalize_optionsu   s    ( 	K!D"/;AACC K K
d)2)D)DT)J)J &&	K 	KK Kr   c                    | j         j        }t          j        |          }|| j         _        | j         j        }| j         j        pg }|                                D ]\  }}|                     |          t          j	        
                    d|           |                    | j                  }t          t          j	        j
        |           |                    |g                               |           |                    fd|D             f           || j         _        || j         _        d | j         _        || j         _        d S )Nzbuilding '%s' sass)r   c                 P    g | ]"}t           j                            |          #S  )osr%   join).0fr   s     r   
<listcomp>z"build_sass.run.<locals>.<listcomp>   s)    EEEaRW\\+q11EEEr   c                      dS )NTr)   r)   r   r   <lambda>z build_sass.run.<locals>.<lambda>   s    4 r   )r    sass_manifestsr   r   package_data
data_filesr!   get_package_dirr   loginfobuildr   map
setdefaultextendappendhas_data_filescompiled_sass_files)r   	manifestsr2   r3   package_namemanifest	css_filesr   s          @r   runzbuild_sass.run|   s\   %4	0;;	+4((5&17R
&/oo&7&7 	 	"L(..|<<KM3\BBB !. '  I 	"I...##L"55<<YGGGEEEE9EEE    *6&'1$+7<(0:---r   c                    |                     d          }| j        s|rt          j        j        | S dS g }|r{	 | j        d                    |                   }|                    d|           t          j        j        | S # t          $ r" |                    d|d                    |d= Y nw xY w|{| j                            d          }||                    d|           |rt          j        j        | S dS )a$  Returns the directory, relative to the top of the source
        distribution, where package ``package`` should be found
        (at least according to the :attr:`package_dir` option, if any).

        Copied from :meth:`distutils.command.build_py.get_package_dir()`
        method.

        . r   )splitr   r*   r%   r+   insertKeyErrorget)r   packager%   tailpdirs        r   r4   zbuild_sass.get_package_dir   s"    }}S!! 	 +w|T**2 	+'7
 At$$$w|T**    AtBx(((HHH  	 #''++DAt$$$ +w|T**2s    B )B.-B.N)__name__
__module____qualname____doc__descriptionr+   r   user_optionsr   r&   rB   r4   r)   r   r   r   r   e   s        ..K SBIIm$$%	
L% % %K K K; ; ;6    r   r   _wrapped_check_readmec                     	 | j         j        }|D ]\  }}| j                            |            n# t          $ r Y nw xY w|                                 S r   )r    r=   filelistr:   AttributeErrorrT   )r   files_rA   s       r   check_readmerZ      s{    	0%9E !& 0 09$$Y////0  	 	 	D	
 ))+++s   1 
>>)rQ   	functoolsos.pathr*   distutils.errorsr   distutils.logdistutils.util
setuptoolsr   setuptools.command.sdistr   builderr   sassr   __all__r	   r   hasattrwrapsrZ   rT   r)   r   r   <module>rg      sA  D DJ                        * * * * * *            
,
 
 
 P P P P P P P Pj wu-.. &Y_U'((, , )(, #("4E%E& &r   