marshal-parser 0.1.1

Parser for Python's "marshal" serialization format
Documentation
�

�Y�e��v�SSKrSSKrSSKJr SSKJr S
SjrS\\4Sjr	S\\4Sjr
S\S\\4S	jrg)�N)�Optional)�InvalidFeatureErrorc��[R"5nURSSSS9 UR5nUR	SSS9nURSSS	S
S9 URSS
S	SS9 URSSS	SS9 URSSSSS9 URSS9 UR	SSS9nURSSSSS9 URSSS	SS9 URSS9 UR	SSS9nURSSSS S9 URSSS	SS9 URSS9 UR	S!S"S9nURS!S9 UR	S#S$S9nURS#S9 UR	S%S&S9nURS%S9 UR	S'S(S9n	U	RS'S9 UR	S)S*S9n
U
RS#S+S9 U
RS)S9 UR	S,S-S9nURS#S.S9 URS,S9 UR	S/S0S9nURS/S9 U(aUR
U5$UR
5$)1z�
Constructs the command-line argument parser for cargo2rpm.

If arguments are passed to this function, they are parsed instead of parsing
actual command line arguments. This is useful for testing parser behaviour.
z-pz--pathz8Path to Cargo.toml (for current crate or workspace root))�help�
buildrequiresz*Print BuildRequires for the current crate.z-tz--with-check�
store_truezInclude dev-dependencies.)�actionrz-az--all-featureszEnable all featuresz-nz--no-default-featureszDisable default featuresz-fz-Fz
--featuresz*Comma-separated list of features to enable)r	�requiresz;Print Requires for the current crate and the given feature.z	--featurez-Name of the feature to generate Requires for.z-sz--subpackagez(Treat the argument as a subpackage name.�providesz;Print Provides for the current crate and the given feature.z-Name of the feature to generate Provides for.�namez$Print the name of the current crate.�versionz'Print the version of the current crate.zis-libzDPrint 1 if the current crate is a library target, otherwise print 0.zis-binzCPrint 1 if the current crate has binary targets, otherwise print 0.�
semver2rpmz7Convert SemVer version string to equivalent RPM format.zSemVer compliant version string�
rpm2semverz7Convert RPM version string to equivalent SemVer format.zRPM version stringzparse-vendor-manifestz:Parse vendor manifest generated by %%cargo_vendor_manifest)�argparse�ArgumentParser�add_argument�add_subparsers�
add_parser�set_defaults�
parse_args)
�args�parser�action_parsers�
action_brs�
action_req�action_prov�action_name�action_version�
action_is_lib�
action_is_bin�action_semver_to_rpm�action_rpm_to_semver�action_parse_vendor_manifests
             �3/home/deca/Projects/rust/cargo2rpm/cargo2rpm/cli.py�get_argsr%s����
$�
$�
&�F�
����h�-g��h��*�*�,�N��*�*�?�Am�*�n�J����D�.��Lg��h����D�"2�<�Nc��d����D�"9�,�Uo��p����D�$��;g��h����?��3��*�*�:�<y�*�z�J����D�$��:i��j����D�.��Lv��w����:��.� �+�+�J�=z�+�{�K����T�4��;j��k����T�>�,�Mw��x����J��/� �+�+�F�9_�+�`�K����F��+�#�.�.�y�?h�.�i�N����y��1�"�-�-�h�>D�-�E�M����h��/�"�-�-�h�>C�-�D�M����h��/�)�4�4�\�IB�4�C���%�%�i�6W�%�X��%�%�\�%�:�)�4�4�\�IB�4�C���%�%�i�6J�%�K��%�%�\�%�:�#1�#<�#<��&b�$=�$� �!�-�-�5L�-�M��� � ��&�&�� � �"�"��returnc���[RR5Vs1sHoRS5iM nnUVs1sHoR	S5(dMUiM sn$s snfs snf)z�
Read lines from standard input and filter out lines that look like paths
to `Cargo.toml` files. This is how RPM generators pass lists of files.
�
z/Cargo.toml��sys�stdin�	readlines�rstrip�endswith��line�liness  r$�get_cargo_toml_paths_from_stdinr3DsN��,/�9�9�+>�+>�+@�A�4�[�[��
�A�E�A�"�C�T�m�m�M�&B�D�C�C��
B��C��A%�A*�A*c���[RR5Vs1sHoRS5iM nnUVs1sHoR	S5(dMUiM sn$s snfs snf)z�
Read lines from standard input and filter out lines that look like paths
to `cargo-vendor.txt` files. This is how RPM generators pass lists of files.
r)z/cargo-vendor.txtr*r0s  r$�%get_cargo_vendor_txt_paths_from_stdinr6NsO��,/�9�9�+>�+>�+@�A�4�[�[��
�A�E�A�"�I�T�m�m�4G�&H�D�I�I��
B��Ir4�
subpackagec�$�URS5(d[S5eURS5(d[S5eURS5R	S5nSU;a(URSS5up#U(d[S5eU$g)	a�
Parses a Rust crate subpackage name into the name of the corresponding
crate feature. This is how RPM generators determine which feature to
generate Provides and Requires for.

Two formats of arguments are valid:

- main subpackage (contains source code): `rust-{crate}-devel`
- feature subpackages (metadata only): `rust-{crate}+{feature}-devel`

Raises an `InvalidFeatureError` for invalid arguments. This exception
triggers RPM generators to produce invalid output, which stops RPM builds.
zrust-z0Invalid subpackage name (missing 'rust-' prefix)z-develz1Invalid subpackage name (missing '-devel' suffix)�+�zNInvalid subpackage name (crate name cannot be empty or contain '+' characters)N)�
startswithrr/�removeprefix�removesuffix�split)r7�crate_plus_feature�crate�features    r$�get_feature_from_subpackagerBXs���� � ��)�)�!�"T�U�U����x�(�(�!�"U�V�V�#�0�0��9�F�F�x�P��
� � �+�1�1�#�q�9����%�&v�w�w���r&)N)rr+�typingr�
cargo2rpm.rpmrr%�set�strr3r6rB�r&r$�<module>rHsR���
��-�9#�xD��S��D�J�s�3�x�J� �C� �H�S�M� r&