pyven 109__tar.gz → 110__tar.gz
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.
- {pyven-109 → pyven-110}/PKG-INFO +1 -1
- pyven-110/pyven/Dockerfile.aridt +12 -0
- {pyven-109 → pyven-110}/pyven/checks.py +8 -45
- pyven-110/pyven/container.py +54 -0
- {pyven-109 → pyven-110}/pyven/metacheck.py +4 -9
- {pyven-109 → pyven-110}/pyven/pipify.py +2 -2
- {pyven-109 → pyven-110}/pyven/projectinfo.py +1 -1
- {pyven-109 → pyven-110}/pyven/release.py +5 -5
- {pyven-109 → pyven-110}/pyven/tryinstall.py +4 -10
- {pyven-109 → pyven-110}/pyven/util.py +0 -16
- {pyven-109 → pyven-110}/pyven.egg-info/PKG-INFO +1 -1
- {pyven-109 → pyven-110}/pyven.egg-info/SOURCES.txt +2 -0
- {pyven-109 → pyven-110}/setup.py +1 -1
- {pyven-109 → pyven-110}/README.md +0 -0
- {pyven-109 → pyven-110}/pyven/README.md.aridt +0 -0
- {pyven-109 → pyven-110}/pyven/__init__.py +0 -0
- {pyven-109 → pyven-110}/pyven/bdist.py +0 -0
- {pyven-109 → pyven-110}/pyven/execcheck.py +0 -0
- {pyven-109 → pyven-110}/pyven/files.py +0 -0
- {pyven-109 → pyven-110}/pyven/functions.py +0 -0
- {pyven-109 → pyven-110}/pyven/licheck.py +0 -0
- {pyven-109 → pyven-110}/pyven/mainmodules.py +0 -0
- {pyven-109 → pyven-110}/pyven/minreqs.py +0 -0
- {pyven-109 → pyven-110}/pyven/nlcheck.py +0 -0
- {pyven-109 → pyven-110}/pyven/patchpolicy.py +0 -0
- {pyven-109 → pyven-110}/pyven/projectinfo.arid +0 -0
- {pyven-109 → pyven-110}/pyven/pyproject.toml.aridt +0 -0
- {pyven-109 → pyven-110}/pyven/release.arid +0 -0
- {pyven-109 → pyven-110}/pyven/setup.py.aridt +0 -0
- {pyven-109 → pyven-110}/pyven/setuptools.arid +0 -0
- {pyven-109 → pyven-110}/pyven/sourceinfo.py +0 -0
- {pyven-109 → pyven-110}/pyven/tasks.py +0 -0
- {pyven-109 → pyven-110}/pyven/tests/__init__.py +0 -0
- {pyven-109 → pyven-110}/pyven.egg-info/dependency_links.txt +0 -0
- {pyven-109 → pyven-110}/pyven.egg-info/entry_points.txt +0 -0
- {pyven-109 → pyven-110}/pyven.egg-info/requires.txt +0 -0
- {pyven-109 → pyven-110}/pyven.egg-info/top_level.txt +0 -0
- {pyven-109 → pyven-110}/setup.cfg +0 -0
{pyven-109 → pyven-110}/PKG-INFO
RENAMED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
FROM python:$(pyversiontag)
|
|
2
|
+
RUN $'[mkdir -pv /etc/apt/keyrings && \
|
|
3
|
+
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
|
|
4
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list && \
|
|
5
|
+
apt-get update && \
|
|
6
|
+
apt-get install -y sudo]
|
|
7
|
+
RUN groupadd -g $str$(docker_gid) docker && \
|
|
8
|
+
groupadd -g $str$(pyven_gid) pyvengroup && \
|
|
9
|
+
useradd -g $str$(pyven_gid) -G docker -u $str$(pyven_uid) -m pyvenuser
|
|
10
|
+
RUN apt-get install -y$join$map($(package) $.( $shstr$()))
|
|
11
|
+
RUN $join$map($(script) $.(cd $'[$(mktemp -d)] && ($()) && rm -rfv $'[$PWD] && )):
|
|
12
|
+
RUN $(pipinstallsh)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
from .container import bgcontainer, Container, pyimage
|
|
1
2
|
from .files import Files
|
|
2
3
|
from .pipify import InstallDeps
|
|
3
4
|
from .projectinfo import ProjectInfo, SimpleInstallDeps
|
|
4
|
-
from .util import
|
|
5
|
+
from .util import Excludes, stderr
|
|
5
6
|
from argparse import ArgumentParser
|
|
6
7
|
from aridity.config import ConfigCtrl
|
|
7
8
|
from aridity.util import NoSuchPathException, openresource
|
|
8
9
|
from diapyr.util import singleton
|
|
9
10
|
from itertools import chain
|
|
10
|
-
from lagoon.
|
|
11
|
-
from lagoon.text import diff, docker, pydoc_markdown
|
|
11
|
+
from lagoon.text import diff, pydoc_markdown
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from setuptools import find_packages
|
|
14
14
|
from shutil import copy2, copytree, ignore_patterns
|
|
@@ -98,26 +98,16 @@ class EveryVersion:
|
|
|
98
98
|
xmlpath = reportsdir / 'nosetests.xml'
|
|
99
99
|
if self.docker:
|
|
100
100
|
coveragepath = self.info.projectdir / '.coverage'
|
|
101
|
-
with bgcontainer('-v', "{0}:{0}".format('/var/run/docker.sock'), '--network', 'host', '-v', f"{os.path.abspath(self.info.projectdir)}:{Container.workdir}",
|
|
102
|
-
container = Container(container)
|
|
101
|
+
with bgcontainer('-v', "{0}:{0}".format('/var/run/docker.sock'), '--network', 'host', '-v', f"{os.path.abspath(self.info.projectdir)}:{Container.workdir}", pyimage(self.info.pyversiontags[0], upstream_devel_packages, upstream_devel_scripts, [])) as container:
|
|
103
102
|
container.cp(installdeps.workspace, 'installdeps')
|
|
104
|
-
container.
|
|
105
|
-
if upstream_devel_packages:
|
|
106
|
-
container.initapt()
|
|
107
|
-
for command in ['apt-get', 'update'], ['apt-get', 'install', '-y', 'sudo'] + upstream_devel_packages:
|
|
108
|
-
container.call(command, check = True, root = True)
|
|
109
|
-
for script in upstream_devel_scripts:
|
|
110
|
-
dirpath = docker.exec[NOEOL](container.container, 'mktemp', '-d') # No need to cleanup, will die with container.
|
|
111
|
-
log.debug("In container dir %s run script: %s", dirpath, script)
|
|
112
|
-
docker.exec[print]('-w', dirpath, '-t', container.container, 'sh', '-c', script)
|
|
113
|
-
installdeps.cinvoke(container)
|
|
103
|
+
container.installasuser(installdeps.containerrequires())
|
|
114
104
|
cpath = lambda p: os.path.relpath(p, self.info.projectdir).replace(os.sep, '/')
|
|
115
|
-
status = container.
|
|
116
|
-
'
|
|
105
|
+
status = container.inworkdir.nosetests[print](
|
|
106
|
+
'--exe', '-v',
|
|
117
107
|
'--with-doctest', '--doctest-extension', '.md',
|
|
118
108
|
'--with-xunit', '--xunit-file', cpath(xmlpath),
|
|
119
109
|
'--with-cov', '--cov-report', 'term-missing',
|
|
120
|
-
|
|
110
|
+
*sum((['--cov', p] for p in chain(find_packages(self.info.projectdir), self.info.py_modules())), []), *map(cpath, self.files.testpaths(xmlpath)), *self.noseargs, check = False)
|
|
121
111
|
else:
|
|
122
112
|
coveragepath = Path('.coverage')
|
|
123
113
|
with Pool(3).readonlyortransient[self.transient](installdeps) as venv:
|
|
@@ -202,33 +192,6 @@ class EveryVersion:
|
|
|
202
192
|
assert f">{xml_escape(self.info.config.name)} \N{BULLET} {xml_escape(self.info.config.tagline)}<" in f.read().decode('utf-8') # TODO: Deduce encoding, consider lagoon URL.
|
|
203
193
|
_runcheck('*', linktree)
|
|
204
194
|
|
|
205
|
-
class Container:
|
|
206
|
-
|
|
207
|
-
workdir = '/io'
|
|
208
|
-
|
|
209
|
-
def __init__(self, container):
|
|
210
|
-
self.uid = os.geteuid()
|
|
211
|
-
self.gid = os.getegid()
|
|
212
|
-
self.container = container
|
|
213
|
-
|
|
214
|
-
def inituser(self):
|
|
215
|
-
docker.exec[print](self.container, 'groupadd', '-g', os.stat('/var/run/docker.sock').st_gid, 'docker')
|
|
216
|
-
docker.exec[print](self.container, 'groupadd', '-g', self.gid, 'pyvengroup')
|
|
217
|
-
docker.exec[print](self.container, 'useradd', '-g', self.gid, '-G', 'docker', '-u', self.uid, '-m', 'pyvenuser')
|
|
218
|
-
|
|
219
|
-
def initapt(self):
|
|
220
|
-
initapt(docker.exec[partial, print](self.container))
|
|
221
|
-
|
|
222
|
-
def install(self, args):
|
|
223
|
-
if args:
|
|
224
|
-
self.call(['pip', 'install', '--user', *args], check = True)
|
|
225
|
-
|
|
226
|
-
def call(self, args, check = False, root = False):
|
|
227
|
-
return docker.exec[print]('-w', self.workdir, self.container, *[] if root else ['sudo', '-u', 'pyvenuser', 'PATH=/home/pyvenuser/.local/bin:/usr/local/bin:/usr/bin:/bin', 'env'], *args, check = check)
|
|
228
|
-
|
|
229
|
-
def cp(self, src, dest):
|
|
230
|
-
docker.cp[print](src, f"{self.container}:{dest}")
|
|
231
|
-
|
|
232
195
|
def main():
|
|
233
196
|
initlogging()
|
|
234
197
|
parser = ArgumentParser()
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from aridity.config import ConfigCtrl
|
|
2
|
+
from contextlib import contextmanager
|
|
3
|
+
from dkrcache.util import iidfile
|
|
4
|
+
from importlib.resources import files
|
|
5
|
+
from lagoon.program import NOEOL, partial
|
|
6
|
+
from lagoon.text import docker
|
|
7
|
+
from lagoon.util import mapcm
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from tempfile import TemporaryDirectory
|
|
10
|
+
import os, shlex
|
|
11
|
+
|
|
12
|
+
@contextmanager
|
|
13
|
+
def bgcontainer(*dockerrunargs):
|
|
14
|
+
cid = docker.run._d[NOEOL](*dockerrunargs, 'sleep', 'inf')
|
|
15
|
+
try:
|
|
16
|
+
yield Container(cid)
|
|
17
|
+
finally:
|
|
18
|
+
docker.rm._f[print](cid)
|
|
19
|
+
|
|
20
|
+
def pyimage(pyversiontag, packages, scripts, requires):
|
|
21
|
+
cc = ConfigCtrl()
|
|
22
|
+
cc.execute('package := $list()')
|
|
23
|
+
cc.execute('script := $list()')
|
|
24
|
+
cc.w.docker_gid = Path('/var/run/docker.sock').stat().st_gid
|
|
25
|
+
for p in packages:
|
|
26
|
+
cc.w.package += p
|
|
27
|
+
requires_sh = ' '.join(map(shlex.quote, requires))
|
|
28
|
+
cc.w.pipinstallsh = f"sudo -u pyvenuser pip install --user --no-warn-script-location {requires_sh}" if requires_sh else ':'
|
|
29
|
+
cc.w.pyven_gid = os.getegid()
|
|
30
|
+
cc.w.pyven_uid = os.geteuid()
|
|
31
|
+
cc.w.pyversiontag = pyversiontag
|
|
32
|
+
for script in scripts:
|
|
33
|
+
cc.w.script += script
|
|
34
|
+
with mapcm(Path, TemporaryDirectory()) as tempdir:
|
|
35
|
+
with (files() / 'Dockerfile.aridt').open() as f, (tempdir / 'Dockerfile').open('w') as g:
|
|
36
|
+
cc.processtemplate(f, g)
|
|
37
|
+
with iidfile() as iid:
|
|
38
|
+
docker.build[print](*iid.args, tempdir)
|
|
39
|
+
return iid.read()
|
|
40
|
+
|
|
41
|
+
class Container:
|
|
42
|
+
|
|
43
|
+
workdir = '/io'
|
|
44
|
+
|
|
45
|
+
def __init__(self, cid):
|
|
46
|
+
self.inworkdir = docker.exec[partial]('-w', self.workdir, cid).sudo._u.pyvenuser[partial]('PATH=/home/pyvenuser/.local/bin:/usr/local/bin:/usr/bin:/bin').env
|
|
47
|
+
self.cid = cid
|
|
48
|
+
|
|
49
|
+
def installasuser(self, requires):
|
|
50
|
+
if requires:
|
|
51
|
+
docker.exec[print](self.cid, 'sudo', '-u', 'pyvenuser', 'pip', 'install', '--user', *requires)
|
|
52
|
+
|
|
53
|
+
def cp(self, src, dest):
|
|
54
|
+
docker.cp[print](src, f"{self.cid}:{dest}")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from .checks import
|
|
1
|
+
from .checks import skip
|
|
2
|
+
from .container import bgcontainer, Container, pyimage
|
|
2
3
|
from .pipify import pipify, setupcommand, setuptoolsreq
|
|
3
4
|
from .projectinfo import ProjectInfo
|
|
4
|
-
from .util import bgcontainer
|
|
5
5
|
from contextlib import contextmanager
|
|
6
6
|
from lagoon.text import diff
|
|
7
7
|
from pathlib import Path
|
|
@@ -18,13 +18,8 @@ def egginfodir(projectdir, version, dockerenabled):
|
|
|
18
18
|
copyinfo = ProjectInfo.seek(tempdir)
|
|
19
19
|
pipify(copyinfo, version)
|
|
20
20
|
if dockerenabled and {'setuptools', 'wheel'} != set(copyinfo.allbuildrequires):
|
|
21
|
-
with bgcontainer('-v', f"{tempdir}:{Container.workdir}",
|
|
22
|
-
container
|
|
23
|
-
container.inituser()
|
|
24
|
-
for command in ['apt-get', 'update'], ['apt-get', 'install', '-y', 'sudo']:
|
|
25
|
-
container.call(command, check = True, root = True)
|
|
26
|
-
container.call(['pip', 'install', *copyinfo.allbuildrequires, setuptoolsreq], check = True, root = True)
|
|
27
|
-
container.call(['python', 'setup.py', 'egg_info'], check = True)
|
|
21
|
+
with bgcontainer('-v', f"{tempdir}:{Container.workdir}", pyimage(copyinfo.pyversiontags[0], [], [], [*copyinfo.allbuildrequires, setuptoolsreq])) as container:
|
|
22
|
+
container.inworkdir.python[print]('setup.py', 'egg_info')
|
|
28
23
|
else:
|
|
29
24
|
setupcommand(copyinfo, False, 'egg_info')
|
|
30
25
|
d, = Path(tempdir).glob('*.egg-info')
|
|
@@ -153,8 +153,8 @@ class InstallDeps:
|
|
|
153
153
|
def invoke(self, venv):
|
|
154
154
|
venv.install([str(i.projectdir) for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
155
155
|
|
|
156
|
-
def
|
|
157
|
-
|
|
156
|
+
def containerrequires(self):
|
|
157
|
+
return [f"/installdeps/{str(i.projectdir.relative_to(self.workspace)).replace(os.sep, '/')}" for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs]
|
|
158
158
|
|
|
159
159
|
def __exit__(self, *exc_info):
|
|
160
160
|
rmtree(self.workspace)
|
|
@@ -145,7 +145,7 @@ class ProjectInfo:
|
|
|
145
145
|
cc.load(infopathorstream)
|
|
146
146
|
self.allbuildrequires = list(cc.r.build.requires)
|
|
147
147
|
self.allrequires = list(cc.r.requires)
|
|
148
|
-
self.pyversiontags = list(cc.r.pyversiontag)
|
|
148
|
+
self.pyversiontags = list(map(str, cc.r.pyversiontag)) # TODO: API to unparse instead of best scalar.
|
|
149
149
|
self.config = cc.node
|
|
150
150
|
self.projectdir = projectdir
|
|
151
151
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'Release project to PyPI, with manylinux wheels as needed.'
|
|
2
2
|
from .checks import EveryVersion
|
|
3
|
+
from .container import bgcontainer
|
|
3
4
|
from .pipify import InstallDeps, pipify, setuptoolsreq
|
|
4
5
|
from .projectinfo import ProjectInfo, SimpleInstallDeps, toreleasetag
|
|
5
6
|
from .sourceinfo import SourceInfo
|
|
6
|
-
from .util import bgcontainer
|
|
7
7
|
from argparse import ArgumentParser
|
|
8
8
|
from aridity.config import ConfigCtrl
|
|
9
9
|
from diapyr.util import singleton
|
|
@@ -63,17 +63,17 @@ class Image:
|
|
|
63
63
|
# TODO: Copy not mount so we can run containers in parallel.
|
|
64
64
|
with bgcontainer('-v', f"{info.projectdir}:/io", f"{self.prefix}{self.plat}:{self.imagetag}") as container:
|
|
65
65
|
def run(execargs, command):
|
|
66
|
-
docker.exec[print](*execargs, container, *self.arch.entrypoint, *command)
|
|
66
|
+
docker.exec[print](*execargs, container.cid, *self.arch.entrypoint, *command)
|
|
67
67
|
if packages:
|
|
68
68
|
run([], chain(['yum', 'install', '-y'], packages))
|
|
69
69
|
for script in scripts:
|
|
70
70
|
# TODO LATER: Run as ordinary sudo-capable user.
|
|
71
|
-
dirpath = docker.exec[NOEOL](container, 'mktemp', '-d') # No need to cleanup, will die with container.
|
|
71
|
+
dirpath = docker.exec[NOEOL](container.cid, 'mktemp', '-d') # No need to cleanup, will die with container.
|
|
72
72
|
log.debug("In container dir %s run script: %s", dirpath, script)
|
|
73
73
|
run(['-w', dirpath, '-t'], ['sh', '-c', script])
|
|
74
|
-
docker.cp[print](resource_filename(__name__, 'patchpolicy.py'), f"{container}:/patchpolicy.py")
|
|
74
|
+
docker.cp[print](resource_filename(__name__, 'patchpolicy.py'), f"{container.cid}:/patchpolicy.py")
|
|
75
75
|
run([], [self.pythonexe, '/patchpolicy.py'])
|
|
76
|
-
docker.cp[print](resource_filename(__name__, 'bdist.py'), f"{container}:/bdist.py")
|
|
76
|
+
docker.cp[print](resource_filename(__name__, 'bdist.py'), f"{container.cid}:/bdist.py")
|
|
77
77
|
run(['-u', f"{os.geteuid()}:{os.getegid()}", '-w', '/io'], [self.pythonexe, '/bdist.py', '--plat', self.plat])
|
|
78
78
|
|
|
79
79
|
def _uploadableartifacts(artifactrelpaths):
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'Check last release can be installed from PyPI and its tests still pass, for use by CI.'
|
|
2
2
|
from .checks import EveryVersion
|
|
3
|
+
from .container import bgcontainer, pyimage
|
|
3
4
|
from .projectinfo import ProjectInfo, toreleasetag
|
|
4
|
-
from .util import bgcontainer, initapt
|
|
5
5
|
from argparse import ArgumentParser
|
|
6
|
-
from lagoon.
|
|
7
|
-
from lagoon.text import docker, git
|
|
6
|
+
from lagoon.text import git
|
|
8
7
|
from roman import fromRoman
|
|
9
8
|
from venvpool import initlogging
|
|
10
9
|
import logging, re
|
|
@@ -27,13 +26,8 @@ def main():
|
|
|
27
26
|
upstream_devel_packages = list(headinfo.config.upstream.devel.packages)
|
|
28
27
|
for pyversion in reversed(headinfo.pyversiontags):
|
|
29
28
|
log.info("Python version: %s", pyversion)
|
|
30
|
-
with bgcontainer(
|
|
31
|
-
|
|
32
|
-
if upstream_devel_packages:
|
|
33
|
-
initapt(containerexec)
|
|
34
|
-
containerexec('apt-get', 'update')
|
|
35
|
-
containerexec('apt-get', 'install', '-y', *upstream_devel_packages)
|
|
36
|
-
containerexec('pip', 'install', req)
|
|
29
|
+
with bgcontainer(pyimage(pyversion, upstream_devel_packages, [], [])) as container:
|
|
30
|
+
container.installasuser([req])
|
|
37
31
|
git.checkout[print](toreleasetag(versionno))
|
|
38
32
|
EveryVersion(ProjectInfo.seek('.'), False, False, [], True, True).nose()
|
|
39
33
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from contextlib import contextmanager
|
|
2
|
-
from lagoon.program import NOEOL
|
|
3
1
|
from pathlib import Path
|
|
4
2
|
import os, re, sys
|
|
5
3
|
|
|
@@ -45,17 +43,3 @@ class Seek:
|
|
|
45
43
|
if os.path.abspath(parent) == os.path.abspath(dirpath):
|
|
46
44
|
break
|
|
47
45
|
dirpath = parent
|
|
48
|
-
|
|
49
|
-
@contextmanager
|
|
50
|
-
def bgcontainer(*dockerrunargs):
|
|
51
|
-
from lagoon.text import docker
|
|
52
|
-
container = docker.run._d[NOEOL](*dockerrunargs, 'sleep', 'inf')
|
|
53
|
-
try:
|
|
54
|
-
yield container
|
|
55
|
-
finally:
|
|
56
|
-
docker.rm._f[print](container)
|
|
57
|
-
|
|
58
|
-
def initapt(dockerexec):
|
|
59
|
-
dockerexec('mkdir', '-pv', '/etc/apt/keyrings')
|
|
60
|
-
dockerexec('curl', '-fsSL', 'https://download.docker.com/linux/debian/gpg', '-o', '/etc/apt/keyrings/docker.asc')
|
|
61
|
-
dockerexec('sh', '-c', 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list')
|
{pyven-109 → pyven-110}/setup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|