pyven 109__tar.gz → 111__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-111}/PKG-INFO +2 -2
- pyven-111/pyven/Dockerfile.aridt +13 -0
- {pyven-109 → pyven-111}/pyven/checks.py +24 -63
- pyven-111/pyven/container.py +55 -0
- {pyven-109 → pyven-111}/pyven/metacheck.py +4 -9
- pyven-111/pyven/pipify.py +213 -0
- {pyven-109 → pyven-111}/pyven/projectinfo.py +8 -21
- {pyven-109 → pyven-111}/pyven/release.py +6 -6
- {pyven-109 → pyven-111}/pyven/tryinstall.py +4 -10
- {pyven-109 → pyven-111}/pyven/util.py +0 -16
- {pyven-109 → pyven-111}/pyven.egg-info/PKG-INFO +2 -2
- {pyven-109 → pyven-111}/pyven.egg-info/SOURCES.txt +2 -0
- {pyven-109 → pyven-111}/pyven.egg-info/requires.txt +1 -1
- {pyven-109 → pyven-111}/setup.py +2 -2
- pyven-109/pyven/pipify.py +0 -163
- {pyven-109 → pyven-111}/README.md +0 -0
- {pyven-109 → pyven-111}/pyven/README.md.aridt +0 -0
- {pyven-109 → pyven-111}/pyven/__init__.py +0 -0
- {pyven-109 → pyven-111}/pyven/bdist.py +0 -0
- {pyven-109 → pyven-111}/pyven/execcheck.py +0 -0
- {pyven-109 → pyven-111}/pyven/files.py +0 -0
- {pyven-109 → pyven-111}/pyven/functions.py +0 -0
- {pyven-109 → pyven-111}/pyven/licheck.py +0 -0
- {pyven-109 → pyven-111}/pyven/mainmodules.py +0 -0
- {pyven-109 → pyven-111}/pyven/minreqs.py +0 -0
- {pyven-109 → pyven-111}/pyven/nlcheck.py +0 -0
- {pyven-109 → pyven-111}/pyven/patchpolicy.py +0 -0
- {pyven-109 → pyven-111}/pyven/projectinfo.arid +0 -0
- {pyven-109 → pyven-111}/pyven/pyproject.toml.aridt +0 -0
- {pyven-109 → pyven-111}/pyven/release.arid +0 -0
- {pyven-109 → pyven-111}/pyven/setup.py.aridt +0 -0
- {pyven-109 → pyven-111}/pyven/setuptools.arid +0 -0
- {pyven-109 → pyven-111}/pyven/sourceinfo.py +0 -0
- {pyven-109 → pyven-111}/pyven/tasks.py +0 -0
- {pyven-109 → pyven-111}/pyven/tests/__init__.py +0 -0
- {pyven-109 → pyven-111}/pyven.egg-info/dependency_links.txt +0 -0
- {pyven-109 → pyven-111}/pyven.egg-info/entry_points.txt +0 -0
- {pyven-109 → pyven-111}/pyven.egg-info/top_level.txt +0 -0
- {pyven-109 → pyven-111}/setup.cfg +0 -0
{pyven-109 → pyven-111}/PKG-INFO
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 111
|
|
4
4
|
Summary: Manage development of multiple Python projects
|
|
5
5
|
Home-page: https://pypi.org/project/pyven/
|
|
6
6
|
Author: Homsar
|
|
7
7
|
Author-email: homsar@foyono.com
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: aridity>=
|
|
9
|
+
Requires-Dist: aridity>=85
|
|
10
10
|
Requires-Dist: diapyr>=31
|
|
11
11
|
Requires-Dist: lagoon>=49
|
|
12
12
|
Requires-Dist: pydoc-markdown>=3.3
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
$join$map($(pipinstallsh) $.[RUN $()
|
|
13
|
+
])$(eolhole)
|
|
@@ -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
|
|
@@ -33,7 +33,7 @@ class yesno:
|
|
|
33
33
|
def _localrepo():
|
|
34
34
|
cc = ConfigCtrl()
|
|
35
35
|
cc.loadsettings()
|
|
36
|
-
return cc.node.buildbot.repo
|
|
36
|
+
return Path(cc.node.buildbot.repo)
|
|
37
37
|
|
|
38
38
|
def _runcheck(variant, check, *args):
|
|
39
39
|
sys.stderr.write(f"{check.__name__}[{variant}]: ")
|
|
@@ -88,45 +88,33 @@ class EveryVersion:
|
|
|
88
88
|
venv.run('check_call', [], 'pyflakes', paths)
|
|
89
89
|
_runcheck(3, pyflakes)
|
|
90
90
|
|
|
91
|
+
basenoseargs = '--capture-output', '--exe', '-v', '--with-doctest', '--doctest-extension', '.md', '--with-cov', '--cov-report', 'term-missing', '--with-xunit'
|
|
92
|
+
|
|
91
93
|
def nose(self):
|
|
92
94
|
upstream_devel_packages = list(self.info.config.upstream.devel.packages)
|
|
93
95
|
upstream_devel_scripts = list(self.info.config.upstream.devel.scripts) if self.userepo else []
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
# TODO: Facility to freeze test requirements graph.
|
|
97
|
+
with InstallDeps(self.info, ('nose-cov', 'pynose', *self.info.config.test.requires), self.siblings, _localrepo(), self.userepo) as installdeps:
|
|
96
98
|
reportsdir = self.info.projectdir / 'var' / '3'
|
|
97
99
|
reportsdir.mkdir(exist_ok = True, parents = True)
|
|
98
100
|
xmlpath = reportsdir / 'nosetests.xml'
|
|
99
101
|
if self.docker:
|
|
100
102
|
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)
|
|
103
|
+
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, *installdeps.corereqslayers())) as container:
|
|
103
104
|
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)
|
|
105
|
+
container.installasuser(installdeps.containerrequires())
|
|
114
106
|
cpath = lambda p: os.path.relpath(p, self.info.projectdir).replace(os.sep, '/')
|
|
115
|
-
status = container.
|
|
116
|
-
|
|
117
|
-
'--
|
|
118
|
-
|
|
119
|
-
'--with-cov', '--cov-report', 'term-missing',
|
|
120
|
-
] + sum((['--cov', p] for p in chain(find_packages(self.info.projectdir), self.info.py_modules())), []) + [cpath(p) for p in self.files.testpaths(xmlpath)] + self.noseargs)
|
|
107
|
+
status = container.inworkdir.nosetests[print](
|
|
108
|
+
*self.basenoseargs, '--xunit-file', cpath(xmlpath),
|
|
109
|
+
*sum((['--cov', p] for p in chain(find_packages(self.info.projectdir), self.info.py_modules())), []), *map(cpath, self.files.testpaths(xmlpath)), *self.noseargs,
|
|
110
|
+
check = False)
|
|
121
111
|
else:
|
|
122
112
|
coveragepath = Path('.coverage')
|
|
123
113
|
with Pool(3).readonlyortransient[self.transient](installdeps) as venv:
|
|
124
114
|
status = venv.run('call', installdeps.localreqs, 'nose', [
|
|
125
|
-
|
|
126
|
-
'--
|
|
127
|
-
|
|
128
|
-
'--with-cov', '--cov-report', 'term-missing',
|
|
129
|
-
] + sum((['--cov', p] for p in chain(find_packages(self.info.projectdir), self.info.py_modules())), []) + [str(p) for p in self.files.testpaths(xmlpath)] + self.noseargs)
|
|
115
|
+
*self.basenoseargs, '--xunit-file', xmlpath,
|
|
116
|
+
*sum((['--cov', p] for p in chain(find_packages(self.info.projectdir), self.info.py_modules())), []), *map(str, self.files.testpaths(xmlpath)), *self.noseargs,
|
|
117
|
+
])
|
|
130
118
|
if coveragepath.exists():
|
|
131
119
|
copy2(coveragepath, reportsdir / 'coverage') # Replace whatever the status, as if we configured the location.
|
|
132
120
|
coveragepath.unlink() # Can't simply use rename cross-device in release case.
|
|
@@ -162,22 +150,22 @@ class EveryVersion:
|
|
|
162
150
|
def readme():
|
|
163
151
|
if not (self.info.config.github.participant or self.info.config.pypi.participant):
|
|
164
152
|
return skip
|
|
165
|
-
|
|
166
|
-
|
|
153
|
+
cc = (-self.info.config).childctrl()
|
|
154
|
+
cc.w.first = first
|
|
167
155
|
if self.info.config.readme_verbose:
|
|
168
|
-
|
|
169
|
-
|
|
156
|
+
cc.w.verbose_blank = ''
|
|
157
|
+
cc.execute('commands * name = $label()')
|
|
170
158
|
mainmodules = sorted(self.info.mainmodules(), key = lambda mm: mm.command)
|
|
171
159
|
undocumented = [mm.command for mm in mainmodules if mm.doc is None]
|
|
172
160
|
if undocumented:
|
|
173
161
|
raise Exception(f"Undocumented: {undocumented}")
|
|
174
162
|
for mm in mainmodules:
|
|
175
|
-
(
|
|
163
|
+
getattr(cc.w.commands, mm.command).doc = mm.doc
|
|
176
164
|
if self.info.config.pydoc_enabled:
|
|
177
|
-
|
|
165
|
+
cc.w.pydoc = getpydoc(mainmodules)
|
|
178
166
|
with NamedTemporaryFile('w') as g:
|
|
179
167
|
with openresource(__name__, 'README.md.aridt') as f:
|
|
180
|
-
|
|
168
|
+
cc.processtemplate(f, g)
|
|
181
169
|
g.flush()
|
|
182
170
|
completed = diff(g.name, self.info.projectdir / 'README.md', check = False)
|
|
183
171
|
sys.stdout.write(completed.stdout)
|
|
@@ -202,33 +190,6 @@ class EveryVersion:
|
|
|
202
190
|
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
191
|
_runcheck('*', linktree)
|
|
204
192
|
|
|
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
193
|
def main():
|
|
233
194
|
initlogging()
|
|
234
195
|
parser = ArgumentParser()
|
|
@@ -0,0 +1,55 @@
|
|
|
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, *requireslayers):
|
|
21
|
+
cc = ConfigCtrl()
|
|
22
|
+
cc.execute('package := $list()')
|
|
23
|
+
cc.execute('pipinstallsh := $list()')
|
|
24
|
+
cc.execute('script := $list()')
|
|
25
|
+
cc.w.docker_gid = Path('/var/run/docker.sock').stat().st_gid
|
|
26
|
+
for p in packages:
|
|
27
|
+
cc.w.package += p
|
|
28
|
+
for requires in requireslayers:
|
|
29
|
+
cc.w.pipinstallsh += f"sudo -u pyvenuser pip install --user --no-warn-script-location {' '.join(map(shlex.quote, requires))}"
|
|
30
|
+
cc.w.pyven_gid = os.getegid()
|
|
31
|
+
cc.w.pyven_uid = os.geteuid()
|
|
32
|
+
cc.w.pyversiontag = pyversiontag
|
|
33
|
+
for script in scripts:
|
|
34
|
+
cc.w.script += script
|
|
35
|
+
with mapcm(Path, TemporaryDirectory()) as tempdir:
|
|
36
|
+
with (files() / 'Dockerfile.aridt').open() as f, (tempdir / 'Dockerfile').open('w') as g:
|
|
37
|
+
cc.processtemplate(f, g)
|
|
38
|
+
with iidfile() as iid:
|
|
39
|
+
docker.build[print](*iid.args, tempdir)
|
|
40
|
+
return iid.read()
|
|
41
|
+
|
|
42
|
+
class Container:
|
|
43
|
+
|
|
44
|
+
workdir = '/io'
|
|
45
|
+
|
|
46
|
+
def __init__(self, cid):
|
|
47
|
+
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
|
|
48
|
+
self.cid = cid
|
|
49
|
+
|
|
50
|
+
def installasuser(self, requires):
|
|
51
|
+
if requires:
|
|
52
|
+
docker.exec[print](self.cid, 'sudo', '-u', 'pyvenuser', 'pip', 'install', '--user', '--no-warn-script-location', *requires)
|
|
53
|
+
|
|
54
|
+
def cp(self, src, dest):
|
|
55
|
+
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')
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
'Generate setuptools files for a project.arid project.'
|
|
2
|
+
from .projectinfo import ProjectInfo, Req, SimpleInstallDeps, toreleasetag
|
|
3
|
+
from argparse import ArgumentParser
|
|
4
|
+
from aridity.config import ConfigCtrl
|
|
5
|
+
from aridity.util import solo
|
|
6
|
+
from diapyr.util import bfs
|
|
7
|
+
from email.parser import Parser
|
|
8
|
+
from itertools import chain
|
|
9
|
+
from lagoon.program import Program
|
|
10
|
+
from lagoon.text import git
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from pkg_resources import resource_filename
|
|
13
|
+
from shutil import copytree, rmtree
|
|
14
|
+
from tempfile import mkdtemp
|
|
15
|
+
from venvpool import initlogging, Pool
|
|
16
|
+
import logging, os
|
|
17
|
+
|
|
18
|
+
log = logging.getLogger(__name__)
|
|
19
|
+
setuptoolsreq = 'setuptools>=69.3,<75.8'
|
|
20
|
+
|
|
21
|
+
def pipify(info, version):
|
|
22
|
+
# Allow release of project without origin:
|
|
23
|
+
if info.config.github.participant:
|
|
24
|
+
_, url = info.descriptionandurl()
|
|
25
|
+
elif info.config.pypi.participant:
|
|
26
|
+
url = f"https://pypi.org/project/{info.config.name}/"
|
|
27
|
+
else:
|
|
28
|
+
url = None
|
|
29
|
+
cc = ConfigCtrl()
|
|
30
|
+
cc.execute('''py_modules := $list()
|
|
31
|
+
install_requires := $list()
|
|
32
|
+
console_scripts := $list()
|
|
33
|
+
''')
|
|
34
|
+
cc.w.name = info.config.name
|
|
35
|
+
cc.w.tagline = info.config.tagline
|
|
36
|
+
for t in info.config.resource.types:
|
|
37
|
+
cc.w.resource.types += t
|
|
38
|
+
cc.w.version = version
|
|
39
|
+
cc.w.description = info.config.tagline
|
|
40
|
+
cc.w.url = url
|
|
41
|
+
if info.config.pypi.participant:
|
|
42
|
+
cc.w.author = info.config.author
|
|
43
|
+
cc.w.author_email = info.config.author_email
|
|
44
|
+
else:
|
|
45
|
+
cc.w.author = cc.w.author_email = None
|
|
46
|
+
for m in info.py_modules():
|
|
47
|
+
cc.w.py_modules += m
|
|
48
|
+
for r in info.allrequires:
|
|
49
|
+
cc.w.install_requires += r
|
|
50
|
+
for s in info.console_scripts():
|
|
51
|
+
cc.w.console_scripts += s
|
|
52
|
+
# XXX: Use soak to generate these?
|
|
53
|
+
tasks = [
|
|
54
|
+
['setup.py', 'setup.py.aridt', 'pystr'],
|
|
55
|
+
]
|
|
56
|
+
@bfs(info.allbuildrequires)
|
|
57
|
+
def proc(bfsinfo, name):
|
|
58
|
+
cc.w.build_requires += name
|
|
59
|
+
if proc.donekeys != {'setuptools', 'wheel'}:
|
|
60
|
+
tasks.append(['pyproject.toml', 'pyproject.toml.aridt', 'tomlquote'])
|
|
61
|
+
for name, template, quote in tasks:
|
|
62
|
+
cc.execute(f'" = $({quote})')
|
|
63
|
+
cc.processtemplate(
|
|
64
|
+
resource_filename(__name__, template), # TODO LATER: Make aridity get the resource.
|
|
65
|
+
os.path.abspath(info.projectdir / name))
|
|
66
|
+
|
|
67
|
+
def main():
|
|
68
|
+
initlogging()
|
|
69
|
+
parser = ArgumentParser()
|
|
70
|
+
parser.add_argument('--transient', action = 'store_true')
|
|
71
|
+
parser.add_argument('projectdir', nargs = '?', type = Path) # FIXME: When projectdir is passed in its console_scripts are not populated!
|
|
72
|
+
args = parser.parse_args()
|
|
73
|
+
info = ProjectInfo.seek('.') if args.projectdir is None else ProjectInfo(args.projectdir, args.projectdir / ProjectInfo.projectaridname)
|
|
74
|
+
pipify(info, info.devversion())
|
|
75
|
+
setupcommand(info, args.transient, 'egg_info')
|
|
76
|
+
|
|
77
|
+
def setupcommand(info, transient, *command):
|
|
78
|
+
with Pool(3).readonlyortransient[transient](SimpleInstallDeps([*info.allbuildrequires, setuptoolsreq])) as venv:
|
|
79
|
+
Program.text(venv.programpath('python'))[print]('setup.py', *command, cwd = info.projectdir)
|
|
80
|
+
|
|
81
|
+
def _metaversion(info):
|
|
82
|
+
with solo(info.projectdir.glob('*.egg-info/PKG-INFO')).open(encoding = 'utf-8') as f:
|
|
83
|
+
return Parser().parse(f)['Version']
|
|
84
|
+
|
|
85
|
+
class VolatileReq:
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def namepart(self):
|
|
89
|
+
return self.info.config.name
|
|
90
|
+
|
|
91
|
+
def __init__(self, info):
|
|
92
|
+
self.versionstr = _metaversion(info)
|
|
93
|
+
self.info = info
|
|
94
|
+
|
|
95
|
+
def acceptversion(self, versionstr):
|
|
96
|
+
return self.versionstr == versionstr
|
|
97
|
+
|
|
98
|
+
def _isreleased(r):
|
|
99
|
+
try:
|
|
100
|
+
if '0' != r.minversion():
|
|
101
|
+
return True
|
|
102
|
+
except ValueError:
|
|
103
|
+
return True
|
|
104
|
+
log.warning("Omit unreleased: %s", r.namepart)
|
|
105
|
+
|
|
106
|
+
class InstallDeps:
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def pypireqs(self):
|
|
110
|
+
return [VolatileReq(i) for i in self.volatileprojects] + self.fetchreqs
|
|
111
|
+
|
|
112
|
+
def __init__(self, info, morereqs, siblings, localrepo, userepo):
|
|
113
|
+
self.info = info
|
|
114
|
+
self.morereqs = morereqs
|
|
115
|
+
self.siblings = siblings
|
|
116
|
+
self.localrepo = localrepo
|
|
117
|
+
self.userepo = userepo
|
|
118
|
+
|
|
119
|
+
def __enter__(self):
|
|
120
|
+
self.workspace = Path(mkdtemp())
|
|
121
|
+
(self.workspace / 'heads').mkdir()
|
|
122
|
+
editableprojects = {}
|
|
123
|
+
volatileprojects = {}
|
|
124
|
+
pypireqs = []
|
|
125
|
+
@bfs([(self.info, self.morereqs, True)])
|
|
126
|
+
class Proc:
|
|
127
|
+
def newdepth(self):
|
|
128
|
+
log.debug("Examine requires of: %s", ', '.join(t[0].config.name for t in self.currentkeys))
|
|
129
|
+
def process(proc, t):
|
|
130
|
+
info, morereqs, root = t
|
|
131
|
+
for r in chain(info.parsedrequires(), Req.parselines(morereqs)):
|
|
132
|
+
name = r.namepart
|
|
133
|
+
if name in editableprojects or name in volatileprojects:
|
|
134
|
+
continue
|
|
135
|
+
if self.siblings:
|
|
136
|
+
siblingpath = r.siblingpath(info.contextworkspace())
|
|
137
|
+
if siblingpath.exists():
|
|
138
|
+
editableprojects[name] = j = ProjectInfo.seek(siblingpath)
|
|
139
|
+
yield j, (), True
|
|
140
|
+
continue
|
|
141
|
+
if self.userepo:
|
|
142
|
+
repopath = self.localrepo / f"{name}.git"
|
|
143
|
+
if repopath.exists():
|
|
144
|
+
if self.siblings:
|
|
145
|
+
log.warning("Not a sibling, install from repo: %s", name)
|
|
146
|
+
clonepath = self.workspace / 'heads' / name
|
|
147
|
+
git.clone[print]('--depth', 1, f"file://{repopath}", clonepath)
|
|
148
|
+
git.fetch.__tags[print](cwd = clonepath)
|
|
149
|
+
volatileprojects[name] = j = ProjectInfo.seek(clonepath)
|
|
150
|
+
yield j, (), False
|
|
151
|
+
continue
|
|
152
|
+
if root: # Otherwise pip will handle it.
|
|
153
|
+
pypireqs.append(r)
|
|
154
|
+
for i in volatileprojects.values():
|
|
155
|
+
pipify(i, _metaversion(i))
|
|
156
|
+
self.localreqs = [str(i.projectdir) for i in editableprojects.values()]
|
|
157
|
+
self.volatileprojects = volatileprojects.values()
|
|
158
|
+
self.fetchreqs = [r for r in pypireqs if _isreleased(r)]
|
|
159
|
+
return self
|
|
160
|
+
|
|
161
|
+
def corereqslayers(self): # TODO: Also cache build-specific requirements for subsequent builds of that kind.
|
|
162
|
+
'PyPI requirements layers for Docker cache, where each is a subset of the next (and a subset of requirements of some build).'
|
|
163
|
+
yield self.morereqs
|
|
164
|
+
if git.status.__porcelain(cwd = self.info.projectdir):
|
|
165
|
+
return
|
|
166
|
+
(self.workspace / 'releases').mkdir()
|
|
167
|
+
volatileprojects = {}
|
|
168
|
+
corereqs = []
|
|
169
|
+
@bfs([(self.info, self.morereqs)])
|
|
170
|
+
class Proc:
|
|
171
|
+
def newdepth(self):
|
|
172
|
+
log.debug("Examine requires of: %s", ', '.join(t[0].config.name for t in self.currentkeys))
|
|
173
|
+
def process(proc, t):
|
|
174
|
+
info, morereqs = t
|
|
175
|
+
for r in chain(info.parsedrequires(), Req.parselines(morereqs)):
|
|
176
|
+
name = r.namepart
|
|
177
|
+
if name in volatileprojects:
|
|
178
|
+
continue
|
|
179
|
+
repopath = self.localrepo / f"{name}.git"
|
|
180
|
+
if repopath.exists():
|
|
181
|
+
clonepath = self.workspace / 'releases' / name
|
|
182
|
+
if (self.workspace / 'heads' / name).exists():
|
|
183
|
+
copytree(self.workspace / 'heads' / name, clonepath)
|
|
184
|
+
else:
|
|
185
|
+
git.clone[print]('--depth', 1, f"file://{repopath}", clonepath)
|
|
186
|
+
git.fetch.__tags[print](cwd = clonepath)
|
|
187
|
+
versionno = max(ProjectInfo.seek(clonepath).releases(), default = 0)
|
|
188
|
+
if versionno:
|
|
189
|
+
for f in toreleasetag, "release/{}".format, "v{}".format:
|
|
190
|
+
if git.checkout[bool, print](f(versionno), cwd = clonepath):
|
|
191
|
+
break
|
|
192
|
+
else:
|
|
193
|
+
raise Exception(f"Failed to checkout version: {versionno}")
|
|
194
|
+
volatileprojects[name] = j = ProjectInfo.seek(clonepath)
|
|
195
|
+
yield j, ()
|
|
196
|
+
else:
|
|
197
|
+
log.warning("Do not use unreleased: %s", name)
|
|
198
|
+
volatileprojects[name] = None
|
|
199
|
+
continue
|
|
200
|
+
corereqs.append(r.reqstr)
|
|
201
|
+
yield corereqs
|
|
202
|
+
|
|
203
|
+
def invoke(self, venv):
|
|
204
|
+
venv.install([str(i.projectdir) for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
205
|
+
|
|
206
|
+
def containerrequires(self):
|
|
207
|
+
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]
|
|
208
|
+
|
|
209
|
+
def __exit__(self, *exc_info):
|
|
210
|
+
rmtree(self.workspace)
|
|
211
|
+
|
|
212
|
+
if '__main__' == __name__:
|
|
213
|
+
main()
|
|
@@ -3,8 +3,7 @@ from .files import Files
|
|
|
3
3
|
from .util import Seek
|
|
4
4
|
from aridity.config import ConfigCtrl
|
|
5
5
|
from aridity.model import Entry, Resource
|
|
6
|
-
from aridity.util import openresource
|
|
7
|
-
from http import HTTPStatus
|
|
6
|
+
from aridity.util import openresource, solo
|
|
8
7
|
from inspect import getsource
|
|
9
8
|
from lagoon.program import Program
|
|
10
9
|
from lagoon.text import git
|
|
@@ -12,8 +11,7 @@ from pkg_resources import parse_requirements
|
|
|
12
11
|
from roman import fromRoman, toRoman
|
|
13
12
|
from setuphacks import getsetupkwargs
|
|
14
13
|
from urllib.error import HTTPError
|
|
15
|
-
from urllib.
|
|
16
|
-
from urllib.request import Request, urlopen
|
|
14
|
+
from urllib.request import urlopen
|
|
17
15
|
from venvpool import ParsedRequires, TemporaryDirectory
|
|
18
16
|
import json, logging, os, re, time, venvpool
|
|
19
17
|
|
|
@@ -32,19 +30,6 @@ class Req:
|
|
|
32
30
|
def parselines(cls, lines):
|
|
33
31
|
return [cls(parsed) for parsed in parse_requirements(lines)]
|
|
34
32
|
|
|
35
|
-
@classmethod
|
|
36
|
-
def published(cls, reqstrs):
|
|
37
|
-
for r in cls.parselines(reqstrs):
|
|
38
|
-
try:
|
|
39
|
-
# FIXME: Allow running tests offline.
|
|
40
|
-
with urlopen(Request(f"https://pypi.org/simple/{url_quote(r.namepart, safe = '')}/", method = 'HEAD')):
|
|
41
|
-
pass
|
|
42
|
-
yield r
|
|
43
|
-
except HTTPError as e:
|
|
44
|
-
if e.code != HTTPStatus.NOT_FOUND:
|
|
45
|
-
raise
|
|
46
|
-
log.warning("Never published: %s", r.namepart)
|
|
47
|
-
|
|
48
33
|
@property
|
|
49
34
|
def namepart(self):
|
|
50
35
|
return self.parsed.name
|
|
@@ -73,9 +58,11 @@ class Req:
|
|
|
73
58
|
def isproject(self, info):
|
|
74
59
|
return self.siblingpath(info.contextworkspace()).exists()
|
|
75
60
|
|
|
61
|
+
def minversion(self):
|
|
62
|
+
return solo(s.version for s in self.specifierset if s.operator in {'>=', '=='})
|
|
63
|
+
|
|
76
64
|
def minstr(self):
|
|
77
|
-
|
|
78
|
-
return f"{self.namepart}=={version}"
|
|
65
|
+
return f"{self.namepart}=={self.minversion()}"
|
|
79
66
|
|
|
80
67
|
def accept(self):
|
|
81
68
|
marker = self.parsed.marker
|
|
@@ -141,11 +128,11 @@ class ProjectInfo:
|
|
|
141
128
|
|
|
142
129
|
def __init__(self, projectdir, infopathorstream):
|
|
143
130
|
cc = ConfigCtrl()
|
|
144
|
-
Resource(__name__, 'projectinfo.arid', 'utf-8').source(cc.scope
|
|
131
|
+
Resource(__name__, 'projectinfo.arid', 'utf-8').source(cc.scope, Entry([])) # TODO: Should be explicit project.arid include.
|
|
145
132
|
cc.load(infopathorstream)
|
|
146
133
|
self.allbuildrequires = list(cc.r.build.requires)
|
|
147
134
|
self.allrequires = list(cc.r.requires)
|
|
148
|
-
self.pyversiontags = list(cc.r.pyversiontag)
|
|
135
|
+
self.pyversiontags = list(map(str, cc.r.pyversiontag)) # TODO: API to unparse instead of best scalar.
|
|
149
136
|
self.config = cc.node
|
|
150
137
|
self.projectdir = projectdir
|
|
151
138
|
|
|
@@ -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):
|
|
@@ -114,7 +114,7 @@ def _warmups(info):
|
|
|
114
114
|
warmups = [w.split(':') for w in info.config.warmups]
|
|
115
115
|
if warmups:
|
|
116
116
|
# XXX: Use the same transient venv as used for running tests?
|
|
117
|
-
with InstallDeps(info, False, None) as installdeps, Pool(3).readonlyortransient[True](installdeps) as venv:
|
|
117
|
+
with InstallDeps(info, (), False, None, False) as installdeps, Pool(3).readonlyortransient[True](installdeps) as venv:
|
|
118
118
|
for m, f in warmups:
|
|
119
119
|
with NamedTemporaryFile('w', suffix = dotpy, dir = info.projectdir) as script:
|
|
120
120
|
script.write(f"from {m} import {f.split('.')[0]}\n{f}()")
|
|
@@ -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')
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 111
|
|
4
4
|
Summary: Manage development of multiple Python projects
|
|
5
5
|
Home-page: https://pypi.org/project/pyven/
|
|
6
6
|
Author: Homsar
|
|
7
7
|
Author-email: homsar@foyono.com
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: aridity>=
|
|
9
|
+
Requires-Dist: aridity>=85
|
|
10
10
|
Requires-Dist: diapyr>=31
|
|
11
11
|
Requires-Dist: lagoon>=49
|
|
12
12
|
Requires-Dist: pydoc-markdown>=3.3
|
{pyven-109 → pyven-111}/setup.py
RENAMED
|
@@ -49,13 +49,13 @@ class SourceInfo:
|
|
|
49
49
|
sourceinfo = SourceInfo('.')
|
|
50
50
|
setup(
|
|
51
51
|
name = 'pyven',
|
|
52
|
-
version = '
|
|
52
|
+
version = '111',
|
|
53
53
|
description = 'Manage development of multiple Python projects',
|
|
54
54
|
url = 'https://pypi.org/project/pyven/',
|
|
55
55
|
author = 'Homsar',
|
|
56
56
|
author_email = 'homsar@foyono.com',
|
|
57
57
|
py_modules = [],
|
|
58
|
-
install_requires = ['aridity>=
|
|
58
|
+
install_requires = ['aridity>=85', 'diapyr>=31', 'lagoon>=49', 'pydoc-markdown>=3.3', 'roman>=5', 'setuptools>=44.1.1', 'twine>=1.15.0', 'venvpool>=14'],
|
|
59
59
|
package_data = {'': ['*.pxd', '*.pyx', '*.pyxbld', '*.arid', '*.aridt']},
|
|
60
60
|
entry_points = {'console_scripts': ['minreqs=pyven.minreqs:main', 'pipify=pyven.pipify:main', 'release=pyven.release:main', 'tasks=pyven.tasks:main', 'tryinstall=pyven.tryinstall:main', 'tests=pyven.tests.__init__:main']},
|
|
61
61
|
**sourceinfo.setup_kwargs(),
|
pyven-109/pyven/pipify.py
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
'Generate setuptools files for a project.arid project.'
|
|
2
|
-
from .projectinfo import ProjectInfo, Req, SimpleInstallDeps
|
|
3
|
-
from argparse import ArgumentParser
|
|
4
|
-
from aridity.config import ConfigCtrl
|
|
5
|
-
from aridity.util import solo
|
|
6
|
-
from diapyr.util import bfs
|
|
7
|
-
from email.parser import Parser
|
|
8
|
-
from lagoon.program import Program
|
|
9
|
-
from lagoon.text import git
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
from pkg_resources import resource_filename
|
|
12
|
-
from shutil import rmtree
|
|
13
|
-
from tempfile import mkdtemp
|
|
14
|
-
from venvpool import initlogging, Pool
|
|
15
|
-
import logging, os
|
|
16
|
-
|
|
17
|
-
log = logging.getLogger(__name__)
|
|
18
|
-
setuptoolsreq = 'setuptools>=69.3,<75.8'
|
|
19
|
-
|
|
20
|
-
def pipify(info, version):
|
|
21
|
-
# Allow release of project without origin:
|
|
22
|
-
if info.config.github.participant:
|
|
23
|
-
_, url = info.descriptionandurl()
|
|
24
|
-
elif info.config.pypi.participant:
|
|
25
|
-
url = f"https://pypi.org/project/{info.config.name}/"
|
|
26
|
-
else:
|
|
27
|
-
url = None
|
|
28
|
-
cc = ConfigCtrl()
|
|
29
|
-
cc.execute('''py_modules := $list()
|
|
30
|
-
install_requires := $list()
|
|
31
|
-
console_scripts := $list()
|
|
32
|
-
''')
|
|
33
|
-
cc.w.name = info.config.name
|
|
34
|
-
cc.w.tagline = info.config.tagline
|
|
35
|
-
for t in info.config.resource.types:
|
|
36
|
-
cc.w.resource.types += t
|
|
37
|
-
cc.w.version = version
|
|
38
|
-
cc.w.description = info.config.tagline
|
|
39
|
-
cc.w.url = url
|
|
40
|
-
if info.config.pypi.participant:
|
|
41
|
-
cc.w.author = info.config.author
|
|
42
|
-
cc.w.author_email = info.config.author_email
|
|
43
|
-
else:
|
|
44
|
-
cc.w.author = cc.w.author_email = None
|
|
45
|
-
for m in info.py_modules():
|
|
46
|
-
cc.w.py_modules += m
|
|
47
|
-
for r in info.allrequires:
|
|
48
|
-
cc.w.install_requires += r
|
|
49
|
-
for s in info.console_scripts():
|
|
50
|
-
cc.w.console_scripts += s
|
|
51
|
-
# XXX: Use soak to generate these?
|
|
52
|
-
tasks = [
|
|
53
|
-
['setup.py', 'setup.py.aridt', 'pystr'],
|
|
54
|
-
]
|
|
55
|
-
@bfs(info.allbuildrequires)
|
|
56
|
-
def proc(bfsinfo, name):
|
|
57
|
-
cc.w.build_requires += name
|
|
58
|
-
if proc.donekeys != {'setuptools', 'wheel'}:
|
|
59
|
-
tasks.append(['pyproject.toml', 'pyproject.toml.aridt', 'tomlquote'])
|
|
60
|
-
for name, template, quote in tasks:
|
|
61
|
-
cc.printf('" = $(%s)', quote)
|
|
62
|
-
cc.processtemplate(
|
|
63
|
-
resource_filename(__name__, template), # TODO LATER: Make aridity get the resource.
|
|
64
|
-
os.path.abspath(info.projectdir / name))
|
|
65
|
-
|
|
66
|
-
def main():
|
|
67
|
-
initlogging()
|
|
68
|
-
parser = ArgumentParser()
|
|
69
|
-
parser.add_argument('--transient', action = 'store_true')
|
|
70
|
-
parser.add_argument('projectdir', nargs = '?', type = Path) # FIXME: When projectdir is passed in its console_scripts are not populated!
|
|
71
|
-
args = parser.parse_args()
|
|
72
|
-
info = ProjectInfo.seek('.') if args.projectdir is None else ProjectInfo(args.projectdir, args.projectdir / ProjectInfo.projectaridname)
|
|
73
|
-
pipify(info, info.devversion())
|
|
74
|
-
setupcommand(info, args.transient, 'egg_info')
|
|
75
|
-
|
|
76
|
-
def setupcommand(info, transient, *command):
|
|
77
|
-
with Pool(3).readonlyortransient[transient](SimpleInstallDeps([*info.allbuildrequires, setuptoolsreq])) as venv:
|
|
78
|
-
Program.text(venv.programpath('python'))[print]('setup.py', *command, cwd = info.projectdir)
|
|
79
|
-
|
|
80
|
-
def _metaversion(info):
|
|
81
|
-
with solo(info.projectdir.glob('*.egg-info/PKG-INFO')).open(encoding = 'utf-8') as f:
|
|
82
|
-
return Parser().parse(f)['Version']
|
|
83
|
-
|
|
84
|
-
class VolatileReq:
|
|
85
|
-
|
|
86
|
-
@property
|
|
87
|
-
def namepart(self):
|
|
88
|
-
return self.info.config.name
|
|
89
|
-
|
|
90
|
-
def __init__(self, info):
|
|
91
|
-
self.versionstr = _metaversion(info)
|
|
92
|
-
self.info = info
|
|
93
|
-
|
|
94
|
-
def acceptversion(self, versionstr):
|
|
95
|
-
return self.versionstr == versionstr
|
|
96
|
-
|
|
97
|
-
class InstallDeps:
|
|
98
|
-
|
|
99
|
-
@property
|
|
100
|
-
def pypireqs(self):
|
|
101
|
-
return [VolatileReq(i) for i in self.volatileprojects] + self.fetchreqs
|
|
102
|
-
|
|
103
|
-
def __init__(self, info, siblings, localrepo):
|
|
104
|
-
self.info = info
|
|
105
|
-
self.siblings = siblings
|
|
106
|
-
self.localrepo = localrepo
|
|
107
|
-
|
|
108
|
-
def __enter__(self):
|
|
109
|
-
self.workspace = mkdtemp()
|
|
110
|
-
editableprojects = {}
|
|
111
|
-
volatileprojects = {}
|
|
112
|
-
pypireqs = []
|
|
113
|
-
def adddeps(i, root):
|
|
114
|
-
for r in i.parsedrequires():
|
|
115
|
-
name = r.namepart
|
|
116
|
-
if name in editableprojects or name in volatileprojects:
|
|
117
|
-
continue
|
|
118
|
-
if self.siblings:
|
|
119
|
-
siblingpath = r.siblingpath(i.contextworkspace())
|
|
120
|
-
if siblingpath.exists():
|
|
121
|
-
editableprojects[name] = j = ProjectInfo.seek(siblingpath)
|
|
122
|
-
yield j, True
|
|
123
|
-
continue
|
|
124
|
-
if self.localrepo is not None:
|
|
125
|
-
repopath = os.path.join(self.localrepo, f"{name}.git")
|
|
126
|
-
if os.path.exists(repopath):
|
|
127
|
-
if self.siblings:
|
|
128
|
-
log.warning("Not a sibling, install from repo: %s", name)
|
|
129
|
-
clonepath = os.path.join(self.workspace, name)
|
|
130
|
-
git.clone[print]('--depth', 1, f"file://{repopath}", clonepath)
|
|
131
|
-
git.fetch.__tags[print](cwd = clonepath)
|
|
132
|
-
volatileprojects[name] = j = ProjectInfo.seek(clonepath)
|
|
133
|
-
yield j, False
|
|
134
|
-
continue
|
|
135
|
-
if root: # Otherwise pip will handle it.
|
|
136
|
-
pypireqs.append(r.reqstr)
|
|
137
|
-
@bfs([(self.info, True)])
|
|
138
|
-
class Proc:
|
|
139
|
-
def newdepth(self):
|
|
140
|
-
log.debug("Examine deps of: %s", ', '.join(i.config.name for i, _ in self.currentkeys))
|
|
141
|
-
def process(self, t):
|
|
142
|
-
return adddeps(*t)
|
|
143
|
-
for i in volatileprojects.values(): # Assume editables already pipified.
|
|
144
|
-
pipify(i, _metaversion(i))
|
|
145
|
-
self.localreqs = [str(i.projectdir) for i in editableprojects.values()]
|
|
146
|
-
self.volatileprojects = volatileprojects.values()
|
|
147
|
-
self.fetchreqs = list(Req.published(pypireqs))
|
|
148
|
-
return self
|
|
149
|
-
|
|
150
|
-
def add(self, *requires):
|
|
151
|
-
self.fetchreqs.extend(Req.parselines(requires))
|
|
152
|
-
|
|
153
|
-
def invoke(self, venv):
|
|
154
|
-
venv.install([str(i.projectdir) for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
155
|
-
|
|
156
|
-
def cinvoke(self, container):
|
|
157
|
-
container.install([f"/installdeps/{os.path.relpath(i.projectdir, self.workspace).replace(os.sep, '/')}" for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
158
|
-
|
|
159
|
-
def __exit__(self, *exc_info):
|
|
160
|
-
rmtree(self.workspace)
|
|
161
|
-
|
|
162
|
-
if '__main__' == __name__:
|
|
163
|
-
main()
|
|
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
|