
    BTh                        d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ ej                  dk  rd dl
Z
nd dlmZ
 d	dZd
dZddZy)    )annotationsN)Path)__semver_version__)   
   c                    t        |       j                         }||j                  k7  rN|dz  j                         r| j                         j	                  |      S |j                  }||j                  k7  rN| S )zGet the path relative to the git root directory. If the path is not
    inside a git repository, the original path itself is returned.
    z.git)r   resolveparentexistsrelative_to)abs_pathgit_paths     g/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/pytest_codspeed/utils.pyget_git_relative_pathr      sk     H~%%'HHOO#v%%'##%11(;;??	 	HOO#
 O    c                    | j                  dd      \  }}|t        |      z  }t        |      }t        |       d| |fS )a  Get the benchmark uri relative to the git root dir and the benchmark name.

    Args:
        nodeid (str): the pytest nodeid, for example:
          testing/test_excinfo.py::TestFormattedExcinfo::test_repr_source
        pytest_rootdir (str): the pytest root dir, for example:
          /home/user/gitrepo/folder

    Returns:
        str: the benchmark uri relative to the git root dir, for example:
          folder/testing/test_excinfo.py::TestFormattedExcinfo::test_repr_source

    z::   )splitr   r   str)nodeidpytest_rootdir	file_path
bench_nameabsolute_file_pathrelative_git_paths         r   get_git_relative_uri_and_namer      sQ     #LLq1Iz'$y/9-.@A$%&b5zBBr   c                     dt         t        j                         dt        j                         t        j                         D  ci c]  } | j                  | j                   c} ddS c c} w )Nzpytest-codspeed)nameversionpid)	sysconfigdependencies)creatorpython)	r   osgetpidr!   get_config_varsimportlib_metadatadistributionsr   r   )ds    r   get_environment_metadatar+   2   sc     &)99;
 #224+=+K+K+M&'		!
 s   A*)r   r   returnr   )r   r   r   r   r,   ztuple[str, str])r,   zdict[str, dict])
__future__r   r%   sysr!   pathlibr   pytest_codspeedr   version_infor(   importlib.metadatametadatar   r   r+    r   r   <module>r5      s;    " 	 
   .g33C(r   