1
- """
2
- Support for installing and building the "wheel" binary package format.
1
+ """Support for installing and building the "wheel" binary package format.
3
2
"""
4
3
5
4
# The following comment should be removed at some point in the future.
@@ -118,8 +117,7 @@ def open_for_csv(name, mode):
118
117
119
118
def replace_python_tag (wheelname , new_tag ):
120
119
# type: (str, str) -> str
121
- """Replace the Python tag in a wheel file name with a new value.
122
- """
120
+ """Replace the Python tag in a wheel file name with a new value."""
123
121
parts = wheelname .split ('-' )
124
122
parts [- 3 ] = new_tag
125
123
return '-' .join (parts )
@@ -128,7 +126,8 @@ def replace_python_tag(wheelname, new_tag):
128
126
def fix_script (path ):
129
127
# type: (str) -> Optional[bool]
130
128
"""Replace #!python with #!/path/to/python
131
- Return True if file was changed."""
129
+ Return True if file was changed.
130
+ """
132
131
# XXX RECORD hashes will need to be updated
133
132
if os .path .isfile (path ):
134
133
with open (path , 'rb' ) as script :
@@ -151,9 +150,7 @@ def fix_script(path):
151
150
152
151
def root_is_purelib (name , wheeldir ):
153
152
# type: (str, str) -> bool
154
- """
155
- Return True if the extracted wheel in wheeldir should go into purelib.
156
- """
153
+ """True if the extracted wheel in wheeldir should go into purelib."""
157
154
name_folded = name .replace ("-" , "_" )
158
155
for item in os .listdir (wheeldir ):
159
156
match = dist_info_re .match (item )
@@ -188,8 +185,9 @@ def get_entrypoints(filename):
188
185
gui = entry_points .get ('gui_scripts' , {})
189
186
190
187
def _split_ep (s ):
191
- """get the string representation of EntryPoint, remove space and split
192
- on '='"""
188
+ """get the string representation of EntryPoint,
189
+ remove space and split on '='
190
+ """
193
191
return str (s ).replace (" " , "" ).split ("=" )
194
192
195
193
# convert the EntryPoint objects into strings with module:function
@@ -201,7 +199,6 @@ def _split_ep(s):
201
199
def message_about_scripts_not_on_PATH (scripts ):
202
200
# type: (Sequence[str]) -> Optional[str]
203
201
"""Determine if any scripts are not on PATH and format a warning.
204
-
205
202
Returns a warning message if one or more scripts are not on PATH,
206
203
otherwise None.
207
204
"""
@@ -261,8 +258,7 @@ def message_about_scripts_not_on_PATH(scripts):
261
258
262
259
def sorted_outrows (outrows ):
263
260
# type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]
264
- """
265
- Return the given rows of a RECORD file in sorted order.
261
+ """Return the given rows of a RECORD file in sorted order.
266
262
267
263
Each row is a 3-tuple (path, hash, size) and corresponds to a record of
268
264
a RECORD file (see PEP 376 and PEP 427 for details). For the rows
@@ -644,9 +640,7 @@ def is_entrypoint_wrapper(name):
644
640
645
641
def wheel_version (source_dir ):
646
642
# type: (Optional[str]) -> Optional[Tuple[int, ...]]
647
- """
648
- Return the Wheel-Version of an extracted wheel, if possible.
649
-
643
+ """Return the Wheel-Version of an extracted wheel, if possible.
650
644
Otherwise, return None if we couldn't parse / extract it.
651
645
"""
652
646
try :
@@ -664,8 +658,7 @@ def wheel_version(source_dir):
664
658
665
659
def check_compatibility (version , name ):
666
660
# type: (Optional[Tuple[int, ...]], str) -> None
667
- """
668
- Raises errors or warns if called with an incompatible Wheel-Version.
661
+ """Raises errors or warns if called with an incompatible Wheel-Version.
669
662
670
663
Pip should refuse to install a Wheel-Version that's a major series
671
664
ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when
@@ -694,8 +687,7 @@ def check_compatibility(version, name):
694
687
695
688
def format_tag (file_tag ):
696
689
# type: (Tuple[str, ...]) -> str
697
- """
698
- Format three tags in the form "<python_tag>-<abi_tag>-<platform_tag>".
690
+ """Format three tags in the form "<python_tag>-<abi_tag>-<platform_tag>".
699
691
700
692
:param file_tag: A 3-tuple of tags (python_tag, abi_tag, platform_tag).
701
693
"""
@@ -743,15 +735,12 @@ def __init__(self, filename):
743
735
744
736
def get_formatted_file_tags (self ):
745
737
# type: () -> List[str]
746
- """
747
- Return the wheel's tags as a sorted list of strings.
748
- """
738
+ """Return the wheel's tags as a sorted list of strings."""
749
739
return sorted (format_tag (tag ) for tag in self .file_tags )
750
740
751
741
def support_index_min (self , tags ):
752
742
# type: (List[Pep425Tag]) -> int
753
- """
754
- Return the lowest index that one of the wheel's file_tag combinations
743
+ """Return the lowest index that one of the wheel's file_tag combinations
755
744
achieves in the given list of supported tags.
756
745
757
746
For example, if there are 8 supported tags and one of the file tags
@@ -767,8 +756,7 @@ def support_index_min(self, tags):
767
756
768
757
def supported (self , tags ):
769
758
# type: (List[Pep425Tag]) -> bool
770
- """
771
- Return whether the wheel is compatible with one of the given tags.
759
+ """Return whether the wheel is compatible with one of the given tags.
772
760
773
761
:param tags: the PEP 425 tags to check the wheel against.
774
762
"""
@@ -791,8 +779,7 @@ def should_use_ephemeral_cache(
791
779
check_binary_allowed , # type: BinaryAllowedPredicate
792
780
):
793
781
# type: (...) -> Optional[bool]
794
- """
795
- Return whether to build an InstallRequirement object using the
782
+ """Return whether to build an InstallRequirement object using the
796
783
ephemeral cache.
797
784
798
785
:param cache_available: whether a cache directory is available for the
@@ -847,9 +834,7 @@ def format_command_result(
847
834
command_output , # type: str
848
835
):
849
836
# type: (...) -> str
850
- """
851
- Format command information for logging.
852
- """
837
+ """Format command information for logging."""
853
838
command_desc = format_command_args (command_args )
854
839
text = 'Command arguments: {}\n ' .format (command_desc )
855
840
@@ -873,9 +858,7 @@ def get_legacy_build_wheel_path(
873
858
command_output , # type: str
874
859
):
875
860
# type: (...) -> Optional[str]
876
- """
877
- Return the path to the wheel in the temporary build directory.
878
- """
861
+ """Return the path to the wheel in the temporary build directory."""
879
862
# Sort for determinism.
880
863
names = sorted (names )
881
864
if not names :
0 commit comments