pyven 110__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.
Files changed (39) hide show
  1. {pyven-110 → pyven-111}/PKG-INFO +2 -2
  2. {pyven-110 → pyven-111}/pyven/Dockerfile.aridt +2 -1
  3. {pyven-110 → pyven-111}/pyven/checks.py +19 -21
  4. {pyven-110 → pyven-111}/pyven/container.py +5 -4
  5. pyven-111/pyven/pipify.py +213 -0
  6. {pyven-110 → pyven-111}/pyven/projectinfo.py +7 -20
  7. {pyven-110 → pyven-111}/pyven/release.py +1 -1
  8. {pyven-110 → pyven-111}/pyven/tryinstall.py +1 -1
  9. {pyven-110 → pyven-111}/pyven.egg-info/PKG-INFO +2 -2
  10. {pyven-110 → pyven-111}/pyven.egg-info/requires.txt +1 -1
  11. {pyven-110 → pyven-111}/setup.py +2 -2
  12. pyven-110/pyven/pipify.py +0 -163
  13. {pyven-110 → pyven-111}/README.md +0 -0
  14. {pyven-110 → pyven-111}/pyven/README.md.aridt +0 -0
  15. {pyven-110 → pyven-111}/pyven/__init__.py +0 -0
  16. {pyven-110 → pyven-111}/pyven/bdist.py +0 -0
  17. {pyven-110 → pyven-111}/pyven/execcheck.py +0 -0
  18. {pyven-110 → pyven-111}/pyven/files.py +0 -0
  19. {pyven-110 → pyven-111}/pyven/functions.py +0 -0
  20. {pyven-110 → pyven-111}/pyven/licheck.py +0 -0
  21. {pyven-110 → pyven-111}/pyven/mainmodules.py +0 -0
  22. {pyven-110 → pyven-111}/pyven/metacheck.py +0 -0
  23. {pyven-110 → pyven-111}/pyven/minreqs.py +0 -0
  24. {pyven-110 → pyven-111}/pyven/nlcheck.py +0 -0
  25. {pyven-110 → pyven-111}/pyven/patchpolicy.py +0 -0
  26. {pyven-110 → pyven-111}/pyven/projectinfo.arid +0 -0
  27. {pyven-110 → pyven-111}/pyven/pyproject.toml.aridt +0 -0
  28. {pyven-110 → pyven-111}/pyven/release.arid +0 -0
  29. {pyven-110 → pyven-111}/pyven/setup.py.aridt +0 -0
  30. {pyven-110 → pyven-111}/pyven/setuptools.arid +0 -0
  31. {pyven-110 → pyven-111}/pyven/sourceinfo.py +0 -0
  32. {pyven-110 → pyven-111}/pyven/tasks.py +0 -0
  33. {pyven-110 → pyven-111}/pyven/tests/__init__.py +0 -0
  34. {pyven-110 → pyven-111}/pyven/util.py +0 -0
  35. {pyven-110 → pyven-111}/pyven.egg-info/SOURCES.txt +0 -0
  36. {pyven-110 → pyven-111}/pyven.egg-info/dependency_links.txt +0 -0
  37. {pyven-110 → pyven-111}/pyven.egg-info/entry_points.txt +0 -0
  38. {pyven-110 → pyven-111}/pyven.egg-info/top_level.txt +0 -0
  39. {pyven-110 → pyven-111}/setup.cfg +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyven
3
- Version: 110
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>=77
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
@@ -9,4 +9,5 @@ RUN groupadd -g $str$(docker_gid) docker && \
9
9
  useradd -g $str$(pyven_gid) -G docker -u $str$(pyven_uid) -m pyvenuser
10
10
  RUN apt-get install -y$join$map($(package) $.( $shstr$()))
11
11
  RUN $join$map($(script) $.(cd $'[$(mktemp -d)] && ($()) && rm -rfv $'[$PWD] && )):
12
- RUN $(pipinstallsh)
12
+ $join$map($(pipinstallsh) $.[RUN $()
13
+ ])$(eolhole)
@@ -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,35 +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
- with InstallDeps(self.info, self.siblings, _localrepo() if self.userepo else None) as installdeps:
95
- installdeps.add('nose-cov', 'pynose', *self.info.config.test.requires) # TODO: Facility to freeze test requires tree.
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}", pyimage(self.info.pyversiontags[0], upstream_devel_packages, upstream_devel_scripts, [])) as 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:
102
104
  container.cp(installdeps.workspace, 'installdeps')
103
105
  container.installasuser(installdeps.containerrequires())
104
106
  cpath = lambda p: os.path.relpath(p, self.info.projectdir).replace(os.sep, '/')
105
107
  status = container.inworkdir.nosetests[print](
106
- '--exe', '-v',
107
- '--with-doctest', '--doctest-extension', '.md',
108
- '--with-xunit', '--xunit-file', cpath(xmlpath),
109
- '--with-cov', '--cov-report', 'term-missing',
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)
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)
111
111
  else:
112
112
  coveragepath = Path('.coverage')
113
113
  with Pool(3).readonlyortransient[self.transient](installdeps) as venv:
114
114
  status = venv.run('call', installdeps.localreqs, 'nose', [
115
- '--exe', '-v',
116
- '--with-doctest', '--doctest-extension', '.md',
117
- '--with-xunit', '--xunit-file', xmlpath,
118
- '--with-cov', '--cov-report', 'term-missing',
119
- ] + 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
+ ])
120
118
  if coveragepath.exists():
121
119
  copy2(coveragepath, reportsdir / 'coverage') # Replace whatever the status, as if we configured the location.
122
120
  coveragepath.unlink() # Can't simply use rename cross-device in release case.
@@ -152,22 +150,22 @@ class EveryVersion:
152
150
  def readme():
153
151
  if not (self.info.config.github.participant or self.info.config.pypi.participant):
154
152
  return skip
155
- config = (-self.info.config).childctrl().node
156
- config.first = first
153
+ cc = (-self.info.config).childctrl()
154
+ cc.w.first = first
157
155
  if self.info.config.readme_verbose:
158
- config.verbose_blank = ''
159
- (-config).execute('commands * name = $label()')
156
+ cc.w.verbose_blank = ''
157
+ cc.execute('commands * name = $label()')
160
158
  mainmodules = sorted(self.info.mainmodules(), key = lambda mm: mm.command)
161
159
  undocumented = [mm.command for mm in mainmodules if mm.doc is None]
162
160
  if undocumented:
163
161
  raise Exception(f"Undocumented: {undocumented}")
164
162
  for mm in mainmodules:
165
- (-config).printf("commands %s doc = %s", mm.command, mm.doc)
163
+ getattr(cc.w.commands, mm.command).doc = mm.doc
166
164
  if self.info.config.pydoc_enabled:
167
- config.pydoc = getpydoc(mainmodules)
165
+ cc.w.pydoc = getpydoc(mainmodules)
168
166
  with NamedTemporaryFile('w') as g:
169
167
  with openresource(__name__, 'README.md.aridt') as f:
170
- (-config).processtemplate(f, g)
168
+ cc.processtemplate(f, g)
171
169
  g.flush()
172
170
  completed = diff(g.name, self.info.projectdir / 'README.md', check = False)
173
171
  sys.stdout.write(completed.stdout)
@@ -17,15 +17,16 @@ def bgcontainer(*dockerrunargs):
17
17
  finally:
18
18
  docker.rm._f[print](cid)
19
19
 
20
- def pyimage(pyversiontag, packages, scripts, requires):
20
+ def pyimage(pyversiontag, packages, scripts, *requireslayers):
21
21
  cc = ConfigCtrl()
22
22
  cc.execute('package := $list()')
23
+ cc.execute('pipinstallsh := $list()')
23
24
  cc.execute('script := $list()')
24
25
  cc.w.docker_gid = Path('/var/run/docker.sock').stat().st_gid
25
26
  for p in packages:
26
27
  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 ':'
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))}"
29
30
  cc.w.pyven_gid = os.getegid()
30
31
  cc.w.pyven_uid = os.geteuid()
31
32
  cc.w.pyversiontag = pyversiontag
@@ -48,7 +49,7 @@ class Container:
48
49
 
49
50
  def installasuser(self, requires):
50
51
  if requires:
51
- docker.exec[print](self.cid, 'sudo', '-u', 'pyvenuser', 'pip', 'install', '--user', *requires)
52
+ docker.exec[print](self.cid, 'sudo', '-u', 'pyvenuser', 'pip', 'install', '--user', '--no-warn-script-location', *requires)
52
53
 
53
54
  def cp(self, src, dest):
54
55
  docker.cp[print](src, f"{self.cid}:{dest}")
@@ -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.parse import quote as url_quote
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
- version, = (s.version for s in self.specifierset if s.operator in {'>=', '=='})
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,7 +128,7 @@ 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(), Entry([])) # TODO: Should be explicit project.arid include.
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)
@@ -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}()")
@@ -26,7 +26,7 @@ def main():
26
26
  upstream_devel_packages = list(headinfo.config.upstream.devel.packages)
27
27
  for pyversion in reversed(headinfo.pyversiontags):
28
28
  log.info("Python version: %s", pyversion)
29
- with bgcontainer(pyimage(pyversion, upstream_devel_packages, [], [])) as container:
29
+ with bgcontainer(pyimage(pyversion, upstream_devel_packages, [])) as container:
30
30
  container.installasuser([req])
31
31
  git.checkout[print](toreleasetag(versionno))
32
32
  EveryVersion(ProjectInfo.seek('.'), False, False, [], True, True).nose()
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyven
3
- Version: 110
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>=77
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
@@ -1,4 +1,4 @@
1
- aridity>=77
1
+ aridity>=85
2
2
  diapyr>=31
3
3
  lagoon>=49
4
4
  pydoc-markdown>=3.3
@@ -49,13 +49,13 @@ class SourceInfo:
49
49
  sourceinfo = SourceInfo('.')
50
50
  setup(
51
51
  name = 'pyven',
52
- version = '110',
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>=77', 'diapyr>=31', 'lagoon>=49', 'pydoc-markdown>=3.3', 'roman>=5', 'setuptools>=44.1.1', 'twine>=1.15.0', 'venvpool>=14'],
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-110/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 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
-
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
File without changes
File without changes