partis-pyproj 0.1.3rc4__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/__init__.py +9 -1
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/_legacy_setup.py +11 -11
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/_nonprintable.py +4 -3
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/backend.py +44 -37
- partis_pyproj-0.1.5.data/purelib/partis/pyproj/builder/builder.py +351 -0
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/builder/cargo.py +5 -6
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/builder/cmake.py +14 -25
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/builder/meson.py +10 -23
- partis_pyproj-0.1.5.data/purelib/partis/pyproj/builder/process.py +42 -0
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/__init__.py +1 -1
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/dist_base.py +75 -86
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/dist_binary.py +6 -24
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/dist_copy.py +7 -18
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/dist_source.py +4 -21
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/dist_targz.py +5 -12
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/dist_zip.py +5 -14
- partis_pyproj-0.1.5.data/purelib/partis/pyproj/file.py +65 -0
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/legacy.py +3 -2
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/load_module.py +7 -6
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/norms.py +35 -31
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/path/__init__.py +2 -1
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/path/match.py +42 -35
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/path/pattern.py +60 -54
- partis_pyproj-0.1.5.data/purelib/partis/pyproj/path/utils.py +94 -0
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/pep.py +36 -35
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/pkginfo.py +7 -16
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/pptoml.py +125 -120
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/pyproj.py +44 -39
- partis_pyproj-0.1.5.data/purelib/partis/pyproj/template.py +229 -0
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/validate.py +279 -269
- partis_pyproj-0.1.5.dist-info/METADATA +500 -0
- partis_pyproj-0.1.5.dist-info/RECORD +37 -0
- partis_pyproj-0.1.3rc4.data/purelib/partis/pyproj/builder/builder.py +0 -153
- partis_pyproj-0.1.3rc4.data/purelib/partis/pyproj/builder/process.py +0 -78
- partis_pyproj-0.1.3rc4.data/purelib/partis/pyproj/path/utils.py +0 -40
- partis_pyproj-0.1.3rc4.dist-info/METADATA +0 -51
- partis_pyproj-0.1.3rc4.dist-info/RECORD +0 -35
- {partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/builder/__init__.py +0 -0
- {partis_pyproj-0.1.3rc4.dist-info → partis_pyproj-0.1.5.dist-info}/LICENSE.txt +0 -0
- {partis_pyproj-0.1.3rc4.dist-info → partis_pyproj-0.1.5.dist-info}/WHEEL +0 -0
- {partis_pyproj-0.1.3rc4.dist-info → partis_pyproj-0.1.5.dist-info}/entry_points.txt +0 -0
- {partis_pyproj-0.1.3rc4.dist-info → partis_pyproj-0.1.5.dist-info}/top_level.txt +0 -0
{partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/builder/cmake.py
RENAMED
@@ -1,25 +1,19 @@
|
|
1
|
-
import
|
2
|
-
import os.path as osp
|
3
|
-
import tempfile
|
1
|
+
from __future__ import annotations
|
4
2
|
import shutil
|
5
|
-
import subprocess
|
6
3
|
|
7
|
-
|
8
|
-
validating,
|
9
|
-
ValidationError,
|
10
|
-
ValidPathError,
|
11
|
-
FileOutsideRootError )
|
12
|
-
|
13
|
-
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
4
|
+
#===============================================================================
|
14
5
|
def cmake_option_arg(k, v):
|
15
6
|
"""Convert python key-value pair to cmake ``-Dkey=value`` option
|
16
7
|
"""
|
8
|
+
typename = ''
|
9
|
+
|
17
10
|
if isinstance(v, bool):
|
11
|
+
typename = ':BOOL'
|
18
12
|
v = ({True: 'ON', False: 'OFF'})[v]
|
19
13
|
|
20
|
-
return f'-D{k}={v}'
|
14
|
+
return f'-D{k}{typename}={v}'
|
21
15
|
|
22
|
-
|
16
|
+
#===============================================================================
|
23
17
|
def cmake(
|
24
18
|
pyproj,
|
25
19
|
logger,
|
@@ -31,7 +25,8 @@ def cmake(
|
|
31
25
|
setup_args,
|
32
26
|
compile_args,
|
33
27
|
install_args,
|
34
|
-
build_clean
|
28
|
+
build_clean,
|
29
|
+
runner):
|
35
30
|
"""Run cmake configure and install commands
|
36
31
|
|
37
32
|
Parameters
|
@@ -49,10 +44,10 @@ def cmake(
|
|
49
44
|
"""
|
50
45
|
|
51
46
|
if not shutil.which('cmake'):
|
52
|
-
raise ValueError(
|
47
|
+
raise ValueError("The 'cmake' program not found.")
|
53
48
|
|
54
49
|
if not shutil.which('ninja'):
|
55
|
-
raise ValueError(
|
50
|
+
raise ValueError("The 'ninja' program not found.")
|
56
51
|
|
57
52
|
# TODO: ensure any paths in setup_args are normalized
|
58
53
|
if not build_clean:
|
@@ -87,13 +82,7 @@ def cmake(
|
|
87
82
|
|
88
83
|
|
89
84
|
if setup_args:
|
90
|
-
|
91
|
-
subprocess.check_call(setup_args)
|
92
|
-
|
93
|
-
logger.debug(' '.join(compile_args))
|
94
|
-
|
95
|
-
subprocess.check_call(compile_args)
|
96
|
-
|
97
|
-
logger.debug(' '.join(install_args))
|
85
|
+
runner.run(setup_args)
|
98
86
|
|
99
|
-
|
87
|
+
runner.run(compile_args)
|
88
|
+
runner.run(install_args)
|
{partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/builder/meson.py
RENAMED
@@ -1,16 +1,8 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import os
|
2
|
-
import os.path as osp
|
3
|
-
import tempfile
|
4
3
|
import shutil
|
5
|
-
import subprocess
|
6
4
|
|
7
|
-
|
8
|
-
validating,
|
9
|
-
ValidationError,
|
10
|
-
ValidPathError,
|
11
|
-
FileOutsideRootError )
|
12
|
-
|
13
|
-
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
5
|
+
#===============================================================================
|
14
6
|
def meson_option_arg(k, v):
|
15
7
|
"""Convert python key-value pair to meson ``-Dkey=value`` option
|
16
8
|
"""
|
@@ -19,7 +11,7 @@ def meson_option_arg(k, v):
|
|
19
11
|
|
20
12
|
return f'-D{k}={v}'
|
21
13
|
|
22
|
-
|
14
|
+
#===============================================================================
|
23
15
|
def meson(
|
24
16
|
pyproj,
|
25
17
|
logger,
|
@@ -31,7 +23,8 @@ def meson(
|
|
31
23
|
setup_args,
|
32
24
|
compile_args,
|
33
25
|
install_args,
|
34
|
-
build_clean
|
26
|
+
build_clean,
|
27
|
+
runner):
|
35
28
|
"""Run meson setup, compile, install commands
|
36
29
|
|
37
30
|
Parameters
|
@@ -49,10 +42,10 @@ def meson(
|
|
49
42
|
"""
|
50
43
|
|
51
44
|
if not shutil.which('meson'):
|
52
|
-
raise ValueError(
|
45
|
+
raise ValueError("The 'meson' program not found.")
|
53
46
|
|
54
47
|
if not shutil.which('ninja'):
|
55
|
-
raise ValueError(
|
48
|
+
raise ValueError("The 'ninja' program not found.")
|
56
49
|
|
57
50
|
os.environ['MESON_FORCE_BACKTRACE'] = '1'
|
58
51
|
|
@@ -89,13 +82,7 @@ def meson(
|
|
89
82
|
|
90
83
|
|
91
84
|
if setup_args:
|
92
|
-
|
93
|
-
subprocess.check_call(setup_args)
|
94
|
-
|
95
|
-
logger.debug(' '.join(compile_args))
|
96
|
-
|
97
|
-
subprocess.check_call(compile_args)
|
98
|
-
|
99
|
-
logger.debug(' '.join(install_args))
|
85
|
+
runner.run(setup_args)
|
100
86
|
|
101
|
-
|
87
|
+
runner.run(compile_args)
|
88
|
+
runner.run(install_args)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from pathlib import Path
|
3
|
+
import logging
|
4
|
+
from .builder import (
|
5
|
+
ProcessRunner)
|
6
|
+
from ..validate import (
|
7
|
+
ValidPathError)
|
8
|
+
|
9
|
+
#===============================================================================
|
10
|
+
def process(
|
11
|
+
pyproj,
|
12
|
+
logger: logging.Logger,
|
13
|
+
options: dict,
|
14
|
+
work_dir: Path,
|
15
|
+
src_dir: Path,
|
16
|
+
build_dir: Path,
|
17
|
+
prefix: Path,
|
18
|
+
setup_args: list[str],
|
19
|
+
compile_args: list[str],
|
20
|
+
install_args: list[str],
|
21
|
+
build_clean: bool,
|
22
|
+
runner: ProcessRunner):
|
23
|
+
"""Run general three-part set of commands
|
24
|
+
"""
|
25
|
+
|
26
|
+
if not ( build_dir.exists() and any(build_dir.iterdir()) ):
|
27
|
+
# build directory is clean
|
28
|
+
...
|
29
|
+
|
30
|
+
elif not build_clean:
|
31
|
+
# skip setup if the build directory should be 'clean'
|
32
|
+
setup_args = list()
|
33
|
+
|
34
|
+
else:
|
35
|
+
raise ValidPathError(
|
36
|
+
f"'build_dir' is not empty, remove manually if this is intended or set 'build_clean = false': {build_dir}")
|
37
|
+
|
38
|
+
|
39
|
+
for cmd in [setup_args, compile_args, install_args]:
|
40
|
+
if cmd:
|
41
|
+
runner.run(cmd)
|
42
|
+
|
{partis_pyproj-0.1.3rc4.data → partis_pyproj-0.1.5.data}/purelib/partis/pyproj/dist_file/__init__.py
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
#===============================================================================
|
3
3
|
from .dist_base import dist_base
|
4
4
|
from .dist_zip import dist_zip
|
5
5
|
from .dist_targz import dist_targz
|
@@ -1,51 +1,47 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import os
|
2
|
-
|
3
|
+
from collections.abc import Callable
|
3
4
|
from pathlib import (
|
4
5
|
Path,
|
5
|
-
PurePath,
|
6
6
|
PurePosixPath)
|
7
|
-
import
|
8
|
-
|
9
|
-
|
7
|
+
from logging import (
|
8
|
+
getLogger,
|
9
|
+
Logger)
|
10
10
|
import re
|
11
11
|
from abc import(
|
12
12
|
ABC,
|
13
13
|
abstractmethod )
|
14
|
-
|
15
14
|
from ..norms import (
|
16
15
|
hash_sha256 )
|
17
|
-
|
18
16
|
from ..validate import (
|
19
|
-
ValidationError,
|
20
|
-
FileOutsideRootError,
|
21
17
|
validating )
|
22
18
|
|
23
|
-
|
19
|
+
#===============================================================================
|
24
20
|
class dist_base( ABC ):
|
25
21
|
"""Builder for file distribution
|
26
22
|
|
27
23
|
Parameters
|
28
24
|
----------
|
29
|
-
outname
|
25
|
+
outname:
|
30
26
|
Name of output file.
|
31
|
-
outdir
|
27
|
+
outdir:
|
32
28
|
Path to directory where the file should be copied after completing build.
|
33
|
-
tmpdir
|
29
|
+
tmpdir:
|
34
30
|
If not None, uses the given directory to place the temporary file(s) before
|
35
31
|
copying to final location.
|
36
32
|
May be the same as outdir.
|
37
|
-
named_dirs
|
33
|
+
named_dirs:
|
38
34
|
Mapping of specially named directories within the distribution.
|
39
35
|
By default a named directory { 'root' : '.' } will be added,
|
40
|
-
unless overridden with another directory name.
|
41
|
-
logger
|
36
|
+
unless overridden with another directory name. Must be in form of Posix path.
|
37
|
+
logger:
|
42
38
|
Logger to which any status information is to be logged.
|
43
39
|
|
44
40
|
Attributes
|
45
41
|
----------
|
46
|
-
outpath :
|
42
|
+
outpath : Path
|
47
43
|
Path to final output file location
|
48
|
-
named_dirs :
|
44
|
+
named_dirs : dict[str, PurePosixPath]
|
49
45
|
Mapping of specially named directories within the distribution
|
50
46
|
opened : bool
|
51
47
|
Build temporary file has been opened for writing
|
@@ -55,8 +51,8 @@ class dist_base( ABC ):
|
|
55
51
|
Build temporary file has been closed
|
56
52
|
copied : bool
|
57
53
|
Build temporary has been copied to ``outpath`` location
|
58
|
-
records :
|
59
|
-
Recorded
|
54
|
+
records : dict[PurePosixPath, tuple[str, int]]
|
55
|
+
Recorded mapping of path to hash, and size (bytes) of files added to distribution
|
60
56
|
record_hash : None | str
|
61
57
|
Final hash value of the record after being finalized
|
62
58
|
|
@@ -67,14 +63,14 @@ class dist_base( ABC ):
|
|
67
63
|
"""
|
68
64
|
#-----------------------------------------------------------------------------
|
69
65
|
def __init__( self,
|
70
|
-
outname,
|
71
|
-
outdir = None,
|
72
|
-
tmpdir = None,
|
73
|
-
logger = None,
|
74
|
-
named_dirs = None ):
|
66
|
+
outname: str,
|
67
|
+
outdir: Path|None = None,
|
68
|
+
tmpdir: Path|None = None,
|
69
|
+
logger: Logger|None = None,
|
70
|
+
named_dirs: dict[str, PurePosixPath]|None = None ):
|
75
71
|
|
76
72
|
if logger is None:
|
77
|
-
logger =
|
73
|
+
logger = getLogger(type(self).__name__)
|
78
74
|
|
79
75
|
if named_dirs is None:
|
80
76
|
named_dirs = dict()
|
@@ -90,8 +86,7 @@ class dist_base( ABC ):
|
|
90
86
|
'root' : PurePosixPath(),
|
91
87
|
**named_dirs }
|
92
88
|
|
93
|
-
|
94
|
-
self.records = list()
|
89
|
+
self.records = dict()
|
95
90
|
self.record_bytes = None
|
96
91
|
self.record_hash = None
|
97
92
|
|
@@ -117,18 +112,18 @@ class dist_base( ABC ):
|
|
117
112
|
|
118
113
|
#-----------------------------------------------------------------------------
|
119
114
|
def write( self,
|
120
|
-
dst,
|
121
|
-
data,
|
122
|
-
mode = None,
|
123
|
-
record = True ):
|
115
|
+
dst: PurePosixPath,
|
116
|
+
data: bytes,
|
117
|
+
mode: int|None = None,
|
118
|
+
record: bool = True ):
|
124
119
|
"""Write data into the distribution file
|
125
120
|
|
126
121
|
Parameters
|
127
122
|
----------
|
128
|
-
dst :
|
129
|
-
data :
|
130
|
-
mode :
|
131
|
-
record :
|
123
|
+
dst :
|
124
|
+
data :
|
125
|
+
mode :
|
126
|
+
record :
|
132
127
|
Add file to the record
|
133
128
|
|
134
129
|
"""
|
@@ -140,18 +135,18 @@ class dist_base( ABC ):
|
|
140
135
|
|
141
136
|
#-----------------------------------------------------------------------------
|
142
137
|
def makedirs( self,
|
143
|
-
dst,
|
144
|
-
mode = None,
|
145
|
-
exist_ok = False,
|
146
|
-
record = True ):
|
138
|
+
dst: PurePosixPath,
|
139
|
+
mode: int|None = None,
|
140
|
+
exist_ok: bool = False,
|
141
|
+
record: bool = True ):
|
147
142
|
"""Behaviour similar to os.makedirs into the distribution file
|
148
143
|
|
149
144
|
Parameters
|
150
145
|
----------
|
151
|
-
dst :
|
152
|
-
mode :
|
153
|
-
exist_ok :
|
154
|
-
record :
|
146
|
+
dst :
|
147
|
+
mode :
|
148
|
+
exist_ok :
|
149
|
+
record :
|
155
150
|
Add file to the record
|
156
151
|
|
157
152
|
Note
|
@@ -167,20 +162,20 @@ class dist_base( ABC ):
|
|
167
162
|
|
168
163
|
#-----------------------------------------------------------------------------
|
169
164
|
def copyfile( self,
|
170
|
-
src,
|
171
|
-
dst,
|
172
|
-
mode = None,
|
173
|
-
exist_ok = False,
|
174
|
-
record = True ):
|
175
|
-
"""
|
165
|
+
src: Path,
|
166
|
+
dst: PurePosixPath,
|
167
|
+
mode: int|None = None,
|
168
|
+
exist_ok: bool = False,
|
169
|
+
record: bool = True ):
|
170
|
+
"""Behavior similar to shutil.copyfile into the distribution file
|
176
171
|
|
177
172
|
Parameters
|
178
173
|
----------
|
179
|
-
src :
|
180
|
-
dst :
|
181
|
-
mode :
|
182
|
-
exist_ok :
|
183
|
-
record :
|
174
|
+
src :
|
175
|
+
dst :
|
176
|
+
mode :
|
177
|
+
exist_ok :
|
178
|
+
record :
|
184
179
|
Add file to the RECORD
|
185
180
|
"""
|
186
181
|
src = Path(src)
|
@@ -208,19 +203,18 @@ class dist_base( ABC ):
|
|
208
203
|
|
209
204
|
#-----------------------------------------------------------------------------
|
210
205
|
def copytree( self,
|
211
|
-
src,
|
212
|
-
dst,
|
213
|
-
ignore = None,
|
214
|
-
exist_ok = False,
|
215
|
-
record = True ):
|
216
|
-
"""
|
206
|
+
src: Path,
|
207
|
+
dst: PurePosixPath,
|
208
|
+
ignore: Callable[[Path, list[str]], list[str]]|None = None,
|
209
|
+
exist_ok: bool = False,
|
210
|
+
record: bool = True ):
|
211
|
+
"""Behavior similar to shutil.copytree into the distribution file
|
217
212
|
|
218
213
|
Parameters
|
219
214
|
----------
|
220
|
-
src :
|
221
|
-
dst :
|
222
|
-
ignore :
|
223
|
-
|
215
|
+
src :
|
216
|
+
dst :
|
217
|
+
ignore :
|
224
218
|
If not None, ``callable(src, names) -> ignored_names``
|
225
219
|
|
226
220
|
See :func:`shutil.copytree`
|
@@ -231,7 +225,6 @@ class dist_base( ABC ):
|
|
231
225
|
src = Path(src)
|
232
226
|
dst = PurePosixPath(dst)
|
233
227
|
|
234
|
-
|
235
228
|
if not src.exists():
|
236
229
|
raise ValueError(f"Source directory not found: {src}")
|
237
230
|
|
@@ -317,50 +310,46 @@ class dist_base( ABC ):
|
|
317
310
|
|
318
311
|
#-----------------------------------------------------------------------------
|
319
312
|
def record( self,
|
320
|
-
dst,
|
321
|
-
data ):
|
313
|
+
dst: PurePosixPath,
|
314
|
+
data: bytes) -> tuple[str, int]:
|
322
315
|
"""Creates a record for an added file
|
323
316
|
|
324
317
|
This produces an sha256 hash of the data and associates a record with the item
|
325
318
|
|
326
319
|
Parameters
|
327
320
|
----------
|
328
|
-
dst
|
321
|
+
dst:
|
329
322
|
Path of item within the distribution
|
330
|
-
data
|
323
|
+
data:
|
331
324
|
Binary data that was added
|
332
325
|
|
333
|
-
Returns
|
334
|
-
-------
|
335
|
-
None
|
336
326
|
"""
|
337
327
|
|
338
328
|
self.assert_recordable()
|
339
329
|
|
340
|
-
hash, size = hash_sha256(
|
330
|
+
hash, size = hash_sha256(data)
|
341
331
|
|
342
|
-
|
332
|
+
dst = PurePosixPath(dst)
|
333
|
+
record = (hash, size)
|
343
334
|
|
344
|
-
self.logger.debug(
|
335
|
+
self.logger.debug(f'record {dst}: {record}')
|
336
|
+
self.records[dst] = record
|
345
337
|
|
346
|
-
|
338
|
+
return record
|
347
339
|
|
348
340
|
#-----------------------------------------------------------------------------
|
349
341
|
def close( self,
|
350
|
-
finalize = True,
|
351
|
-
copy = True ):
|
342
|
+
finalize: bool = True,
|
343
|
+
copy: bool = True ):
|
352
344
|
"""Closes the temporary distribution file
|
353
345
|
|
354
346
|
Parameters
|
355
347
|
----------
|
356
|
-
finalize :
|
348
|
+
finalize :
|
357
349
|
If true, finalizes the temporary distribution file before closing
|
358
|
-
copy :
|
350
|
+
copy :
|
359
351
|
If true, copies the temporary file to final location after closing
|
360
352
|
|
361
|
-
Returns
|
362
|
-
-------
|
363
|
-
None
|
364
353
|
"""
|
365
354
|
|
366
355
|
if self.closed:
|
@@ -441,12 +430,12 @@ class dist_base( ABC ):
|
|
441
430
|
|
442
431
|
#-----------------------------------------------------------------------------
|
443
432
|
@abstractmethod
|
444
|
-
def finalize( self ):
|
433
|
+
def finalize( self ) -> str|None:
|
445
434
|
"""Finalizes the distribution file before being closed
|
446
435
|
|
447
436
|
Returns
|
448
437
|
-------
|
449
|
-
record_hash :
|
438
|
+
record_hash :
|
450
439
|
sha256 hash of the record
|
451
440
|
|
452
441
|
Note
|
@@ -1,47 +1,31 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import os
|
2
|
-
import os.path as osp
|
3
3
|
import io
|
4
|
-
import warnings
|
5
|
-
import stat
|
6
4
|
import csv
|
7
|
-
|
8
|
-
import tempfile
|
9
|
-
import shutil
|
10
|
-
|
11
5
|
from pathlib import (
|
12
|
-
Path,
|
13
|
-
PurePath,
|
14
6
|
PurePosixPath)
|
15
|
-
|
16
7
|
from ..norms import (
|
17
|
-
norm_path,
|
18
|
-
norm_data,
|
19
8
|
hash_sha256,
|
20
9
|
email_encode_items )
|
21
|
-
|
22
10
|
from ..pep import (
|
23
|
-
norm_dist_name,
|
24
11
|
norm_dist_build,
|
25
12
|
norm_dist_compat,
|
26
13
|
compress_dist_compat,
|
27
14
|
norm_dist_filename )
|
28
|
-
|
29
15
|
from ..pkginfo import PkgInfo
|
30
|
-
|
31
16
|
from .dist_zip import dist_zip
|
32
|
-
|
33
17
|
from ..path import (
|
34
18
|
subdir,
|
35
19
|
PathError )
|
36
20
|
|
37
|
-
|
21
|
+
#===============================================================================
|
38
22
|
def pkg_name(dir):
|
39
23
|
if dir.endswith('.py'):
|
40
24
|
return dir[:-3]
|
41
25
|
|
42
26
|
return dir
|
43
27
|
|
44
|
-
|
28
|
+
#===============================================================================
|
45
29
|
class dist_binary_wheel( dist_zip ):
|
46
30
|
"""Build a binary distribution :pep:`427`, :pep:`491` wheel file ``*.whl``
|
47
31
|
|
@@ -227,10 +211,8 @@ class dist_binary_wheel( dist_zip ):
|
|
227
211
|
|
228
212
|
platlib = self.named_dirs['platlib']
|
229
213
|
|
230
|
-
for file, hash, size in self.records:
|
214
|
+
for file, (hash, size) in self.records.items():
|
231
215
|
# check files added to purelib and platlib.
|
232
|
-
file = PurePosixPath(file)
|
233
|
-
|
234
216
|
try:
|
235
217
|
top_level.add(pkg_name(subdir(purelib, file).parts[0]))
|
236
218
|
continue
|
@@ -287,9 +269,9 @@ class dist_binary_wheel( dist_zip ):
|
|
287
269
|
|
288
270
|
# the record file itself is listed in records, but the hash of the record
|
289
271
|
# file cannot be included in the file.
|
290
|
-
_records = self.records
|
272
|
+
_records = {**self.records, self.record_path: ('', '')}
|
291
273
|
|
292
|
-
for file, hash, size in _records:
|
274
|
+
for file, (hash, size) in _records.items():
|
293
275
|
hash = f'sha256={hash}' if hash else ''
|
294
276
|
record_csv.writerow([os.fspath(file), hash, size])
|
295
277
|
|
@@ -1,30 +1,19 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import os
|
2
|
-
import os.path as osp
|
3
3
|
import glob
|
4
|
-
import pathlib
|
5
4
|
from pathlib import (
|
6
|
-
Path
|
7
|
-
PurePath,
|
8
|
-
PurePosixPath)
|
9
|
-
|
5
|
+
Path)
|
10
6
|
import logging
|
11
|
-
|
12
7
|
from ..validate import (
|
13
|
-
ValidationError,
|
14
8
|
FileOutsideRootError,
|
15
9
|
validating )
|
16
|
-
|
17
|
-
from ..norms import (
|
18
|
-
norm_path )
|
19
|
-
|
20
10
|
from ..path import (
|
21
|
-
PathMatcher,
|
22
11
|
PathFilter,
|
23
12
|
subdir,
|
24
13
|
combine_ignore_patterns,
|
25
|
-
|
14
|
+
resolve)
|
26
15
|
|
27
|
-
#
|
16
|
+
# #===============================================================================
|
28
17
|
# def rematch_replace(rematch, replace, name):
|
29
18
|
|
30
19
|
# m = rematch.fullmatch(path)
|
@@ -42,7 +31,7 @@ from ..path import (
|
|
42
31
|
|
43
32
|
|
44
33
|
|
45
|
-
|
34
|
+
#===============================================================================
|
46
35
|
def dist_iter(*,
|
47
36
|
include,
|
48
37
|
ignore,
|
@@ -100,7 +89,7 @@ def dist_iter(*,
|
|
100
89
|
yield (i, _src, _dst, _ignore_patterns, False)
|
101
90
|
|
102
91
|
|
103
|
-
|
92
|
+
#===============================================================================
|
104
93
|
def dist_copy(*,
|
105
94
|
base_path,
|
106
95
|
include,
|
@@ -129,7 +118,7 @@ def dist_copy(*,
|
|
129
118
|
logger.debug( f'ignoring: {src}' )
|
130
119
|
continue
|
131
120
|
|
132
|
-
src_abs =
|
121
|
+
src_abs = resolve(src)
|
133
122
|
|
134
123
|
if root and not subdir(root, src_abs, check = False):
|
135
124
|
raise FileOutsideRootError(
|
@@ -1,30 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import os.path as osp
|
3
|
-
import io
|
4
|
-
import warnings
|
5
|
-
import stat
|
6
|
-
|
7
|
-
import shutil
|
8
|
-
|
1
|
+
from __future__ import annotations
|
9
2
|
from pathlib import (
|
10
|
-
Path,
|
11
|
-
PurePath,
|
12
3
|
PurePosixPath)
|
13
|
-
|
14
|
-
from ..norms import (
|
15
|
-
norm_path,
|
16
|
-
norm_data,
|
17
|
-
norm_mode )
|
18
|
-
|
19
4
|
from ..pep import (
|
20
5
|
norm_dist_filename )
|
21
|
-
|
22
6
|
from ..pkginfo import PkgInfo
|
23
|
-
|
24
7
|
from .dist_base import dist_base
|
25
8
|
from .dist_targz import dist_targz
|
26
9
|
|
27
|
-
|
10
|
+
#===============================================================================
|
28
11
|
class dist_source_targz( dist_targz ):
|
29
12
|
"""Build a source distribution ``*.tar.gz`` file
|
30
13
|
|
@@ -118,7 +101,7 @@ class dist_source_targz( dist_targz ):
|
|
118
101
|
data = self.pkg_info.encode_pkg_info() )
|
119
102
|
|
120
103
|
|
121
|
-
|
104
|
+
#===============================================================================
|
122
105
|
class dist_source_dummy( dist_base ):
|
123
106
|
"""Build a dummy source distribution without a physical file
|
124
107
|
"""
|
@@ -142,7 +125,7 @@ class dist_source_dummy( dist_base ):
|
|
142
125
|
self.base_path = PurePosixPath('-'.join( sdist_name_parts ))
|
143
126
|
|
144
127
|
self.metadata_path = self.base_path.joinpath('PKG-INFO')
|
145
|
-
|
128
|
+
|
146
129
|
super().__init__(
|
147
130
|
outname = '-'.join( sdist_name_parts ) + '.tar.gz',
|
148
131
|
outdir = outdir,
|