pyven 100__tar.gz → 102__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-100 → pyven-102}/PKG-INFO +1 -7
- {pyven-100 → pyven-102}/README.md +0 -6
- {pyven-100 → pyven-102}/pyven/bdist.py +1 -1
- {pyven-100 → pyven-102}/pyven/checks.py +8 -8
- {pyven-100 → pyven-102}/pyven/execcheck.py +3 -3
- {pyven-100 → pyven-102}/pyven/files.py +11 -20
- {pyven-100 → pyven-102}/pyven/licheck.py +11 -11
- {pyven-100 → pyven-102}/pyven/mainmodules.py +2 -2
- {pyven-100 → pyven-102}/pyven/pipify.py +4 -4
- {pyven-100 → pyven-102}/pyven/projectinfo.py +19 -14
- {pyven-100 → pyven-102}/pyven/release.py +14 -15
- {pyven-100 → pyven-102}/pyven/sourceinfo.py +3 -3
- {pyven-100 → pyven-102}/pyven/tryinstall.py +5 -5
- {pyven-100 → pyven-102}/pyven/util.py +5 -29
- {pyven-100 → pyven-102}/pyven.egg-info/PKG-INFO +1 -7
- {pyven-100 → pyven-102}/pyven.egg-info/SOURCES.txt +0 -2
- {pyven-100 → pyven-102}/pyven.egg-info/entry_points.txt +0 -2
- {pyven-100 → pyven-102}/setup.py +5 -5
- pyven-100/pyven/drmake.py +0 -11
- pyven-100/pyven/launch.py +0 -23
- {pyven-100 → pyven-102}/pyven/README.md.aridt +0 -0
- {pyven-100 → pyven-102}/pyven/__init__.py +0 -0
- {pyven-100 → pyven-102}/pyven/divcheck.py +0 -0
- {pyven-100 → pyven-102}/pyven/functions.py +0 -0
- {pyven-100 → pyven-102}/pyven/minreqs.py +0 -0
- {pyven-100 → pyven-102}/pyven/nlcheck.py +0 -0
- {pyven-100 → pyven-102}/pyven/patchpolicy.py +0 -0
- {pyven-100 → pyven-102}/pyven/projectinfo.arid +0 -0
- {pyven-100 → pyven-102}/pyven/pyproject.toml.aridt +0 -0
- {pyven-100 → pyven-102}/pyven/release.arid +0 -0
- {pyven-100 → pyven-102}/pyven/setup.cfg.aridt +0 -0
- {pyven-100 → pyven-102}/pyven/setup.py.aridt +0 -0
- {pyven-100 → pyven-102}/pyven/setuptools.arid +0 -0
- {pyven-100 → pyven-102}/pyven/tasks.py +0 -0
- {pyven-100 → pyven-102}/pyven/tests/__init__.py +0 -0
- {pyven-100 → pyven-102}/pyven.egg-info/dependency_links.txt +0 -0
- {pyven-100 → pyven-102}/pyven.egg-info/requires.txt +0 -0
- {pyven-100 → pyven-102}/pyven.egg-info/top_level.txt +0 -0
- {pyven-100 → pyven-102}/setup.cfg +0 -0
{pyven-100 → pyven-102}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 102
|
|
4
4
|
Summary: Manage development of multiple Python projects
|
|
5
5
|
Home-page: https://pypi.org/project/pyven/
|
|
6
6
|
Author: Homsar
|
|
@@ -19,12 +19,6 @@ Manage development of multiple Python projects
|
|
|
19
19
|
|
|
20
20
|
## Commands
|
|
21
21
|
|
|
22
|
-
### drmake
|
|
23
|
-
Build a Docker image with automatic tag.
|
|
24
|
-
|
|
25
|
-
### launch
|
|
26
|
-
Run project using a suitable venv from the pool.
|
|
27
|
-
|
|
28
22
|
### minreqs
|
|
29
23
|
Pin requires to their minimum allowed versions.
|
|
30
24
|
|
|
@@ -3,12 +3,6 @@ Manage development of multiple Python projects
|
|
|
3
3
|
|
|
4
4
|
## Commands
|
|
5
5
|
|
|
6
|
-
### drmake
|
|
7
|
-
Build a Docker image with automatic tag.
|
|
8
|
-
|
|
9
|
-
### launch
|
|
10
|
-
Run project using a suitable venv from the pool.
|
|
11
|
-
|
|
12
6
|
### minreqs
|
|
13
7
|
Pin requires to their minimum allowed versions.
|
|
14
8
|
|
|
@@ -14,7 +14,7 @@ def main():
|
|
|
14
14
|
args = parser.parse_args()
|
|
15
15
|
holder = mkdtemp()
|
|
16
16
|
try:
|
|
17
|
-
for pip in sorted(iglob("/opt/python/cp[
|
|
17
|
+
for pip in sorted(iglob(f"/opt/python/cp[{''.join(args.pyversions)}]*/bin/pip")):
|
|
18
18
|
compatibility = pip.split(os.sep)[3]
|
|
19
19
|
log.info("Make wheel(s) for implementation-ABI: %s", compatibility)
|
|
20
20
|
try:
|
|
@@ -34,7 +34,7 @@ def _localrepo():
|
|
|
34
34
|
return cc.node.buildbot.repo
|
|
35
35
|
|
|
36
36
|
def _runcheck(variant, check, *args):
|
|
37
|
-
sys.stderr.write("
|
|
37
|
+
sys.stderr.write(f"{check.__name__}[{variant}]: ")
|
|
38
38
|
sys.stderr.flush()
|
|
39
39
|
stderr('SKIP' if check(*args) is skip else 'OK')
|
|
40
40
|
|
|
@@ -84,7 +84,7 @@ class EveryVersion:
|
|
|
84
84
|
def divcheck():
|
|
85
85
|
if pyversion >= 3:
|
|
86
86
|
return skip
|
|
87
|
-
subprocess.check_call(["python
|
|
87
|
+
subprocess.check_call([f"python{pyversion}", scriptpath] + self.files.pypaths)
|
|
88
88
|
for pyversion in self.info.config.pyversions:
|
|
89
89
|
_runcheck(pyversion, divcheck)
|
|
90
90
|
|
|
@@ -109,7 +109,7 @@ class EveryVersion:
|
|
|
109
109
|
xmlpath = os.path.join(reportsdir, 'nosetests.xml')
|
|
110
110
|
if self.docker:
|
|
111
111
|
coveragepath = os.path.join(self.info.projectdir, '.coverage')
|
|
112
|
-
with bgcontainer('-v', "{0}:{0}".format('/var/run/docker.sock'), '--network', 'host', '-v', "
|
|
112
|
+
with bgcontainer('-v', "{0}:{0}".format('/var/run/docker.sock'), '--network', 'host', '-v', f"{os.path.abspath(self.info.projectdir)}:{Container.workdir}", f"python:{pyversiontags[pyversion][0]}") as container:
|
|
113
113
|
container = Container(container)
|
|
114
114
|
container.cp(installdeps.workspace, 'installdeps')
|
|
115
115
|
container.inituser()
|
|
@@ -119,7 +119,7 @@ class EveryVersion:
|
|
|
119
119
|
container.call(command, check = True, root = True)
|
|
120
120
|
for script in upstream_devel_scripts:
|
|
121
121
|
from lagoon import docker
|
|
122
|
-
dirpath = docker[NOEOL](
|
|
122
|
+
dirpath = docker.exec[NOEOL](container.container, 'mktemp', '-d') # No need to cleanup, will die with container.
|
|
123
123
|
log.debug("In container dir %s run script: %s", dirpath, script)
|
|
124
124
|
docker.exec[print]('-w', dirpath, '-t', container.container, 'sh', '-c', script)
|
|
125
125
|
installdeps.cinvoke(container)
|
|
@@ -175,7 +175,7 @@ except AttributeError:
|
|
|
175
175
|
f.truncate()
|
|
176
176
|
modules.append(os.path.relpath(dirpath if '__init__.py' == name else pypath[:-len(dotpy)], pydocdir).replace(os.sep, '.'))
|
|
177
177
|
acc = re.sub('^#', '###', pydoc_markdown('--search-path', pydocdir), flags = re.MULTILINE)
|
|
178
|
-
acc = re.split(
|
|
178
|
+
acc = re.split(f"""(?=^<a id="(?:{'|'.join(map(re.escape, modules))})")""", acc, flags = re.MULTILINE) # Module names are markup attribute-safe.
|
|
179
179
|
return ''.join(sorted(block for block in acc if block and re.search('"([^"]+)', block).group(1) not in internal))
|
|
180
180
|
def readme():
|
|
181
181
|
if not (self.info.config.github.participant or self.info.config.pypi.participant):
|
|
@@ -188,7 +188,7 @@ except AttributeError:
|
|
|
188
188
|
mainmodules = sorted(self.info.mainmodules(), key = lambda mm: mm.command)
|
|
189
189
|
undocumented = [mm.command for mm in mainmodules if mm.doc is None]
|
|
190
190
|
if undocumented:
|
|
191
|
-
raise Exception("Undocumented:
|
|
191
|
+
raise Exception(f"Undocumented: {undocumented}")
|
|
192
192
|
for mm in mainmodules:
|
|
193
193
|
(-config).printf("commands %s doc = %s", mm.command, mm.doc)
|
|
194
194
|
if self.info.config.pydoc_enabled:
|
|
@@ -218,8 +218,8 @@ except AttributeError:
|
|
|
218
218
|
return skip
|
|
219
219
|
from urllib.request import urlopen
|
|
220
220
|
from xml.sax.saxutils import escape
|
|
221
|
-
with urlopen("https://linktr.ee
|
|
222
|
-
assert "
|
|
221
|
+
with urlopen(f"https://linktr.ee/{account}") as f: # TODO: Percent-encode.
|
|
222
|
+
assert f">{escape(self.info.config.name)} \N{BULLET} {escape(self.info.config.tagline)}<" in f.read().decode('utf-8') # TODO: Deduce encoding, consider lagoon URL.
|
|
223
223
|
_runcheck('*', linktree)
|
|
224
224
|
|
|
225
225
|
class Container:
|
|
@@ -11,11 +11,11 @@ def execcheck(paths):
|
|
|
11
11
|
hasmagic = f.readline().startswith(magic)
|
|
12
12
|
if basename.lower().startswith('test'):
|
|
13
13
|
if not basename.startswith('test_'):
|
|
14
|
-
raise Exception("Inconsistent name:
|
|
14
|
+
raise Exception(f"Inconsistent name: {path}") # Note pyflakes already checks for duplicate method names.
|
|
15
15
|
if executable:
|
|
16
|
-
raise Exception("Should not be executable:
|
|
16
|
+
raise Exception(f"Should not be executable: {path}")
|
|
17
17
|
if hasmagic:
|
|
18
|
-
raise Exception("Using
|
|
18
|
+
raise Exception(f"Using {magic} is obsolete: {path}")
|
|
19
19
|
else:
|
|
20
20
|
if executable != hasmagic:
|
|
21
21
|
raise Exception(path)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from .util import stripeol
|
|
2
1
|
from collections import defaultdict
|
|
3
2
|
import os, subprocess, xml.dom.minidom as dom
|
|
4
3
|
|
|
@@ -23,27 +22,19 @@ class Files:
|
|
|
23
22
|
@classmethod
|
|
24
23
|
def relpaths(cls, root, suffixes, prefixes):
|
|
25
24
|
paths = list(cls._findfiles(root, suffixes, prefixes))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if
|
|
35
|
-
|
|
36
|
-
paths = [p for p in paths if not p.startswith(submoduleslash)]
|
|
37
|
-
if paths:
|
|
38
|
-
p = subprocess.Popen(['git', 'check-ignore'] + paths, stdout = subprocess.PIPE, cwd = root)
|
|
39
|
-
ignored = set(p.communicate()[0].decode().splitlines())
|
|
40
|
-
assert p.wait() in [0, 1]
|
|
41
|
-
for path in paths:
|
|
42
|
-
if path not in ignored:
|
|
43
|
-
yield path
|
|
25
|
+
if os.path.exists(os.path.join(root, '.gitmodules')):
|
|
26
|
+
for submoduleslash in (l.split(' ', 1)[1] + os.sep for l in subprocess.check_output(['git', 'config', '--file', '.gitmodules', '--get-regexp', '^submodule[.].+[.]path$'], cwd = root).decode().splitlines()):
|
|
27
|
+
paths = [p for p in paths if not p.startswith(submoduleslash)]
|
|
28
|
+
if paths:
|
|
29
|
+
p = subprocess.Popen(['git', 'check-ignore'] + paths, stdout = subprocess.PIPE, cwd = root)
|
|
30
|
+
ignored = set(p.communicate()[0].decode().splitlines())
|
|
31
|
+
assert p.wait() in [0, 1]
|
|
32
|
+
for path in paths:
|
|
33
|
+
if path not in ignored:
|
|
34
|
+
yield path
|
|
44
35
|
|
|
45
36
|
def __init__(self, root):
|
|
46
|
-
srcsuffixes = sum(([s, "
|
|
37
|
+
srcsuffixes = sum(([s, f"{s}.aridt"] for s in ['.py', '.py3', '.pyx', '.s', '.sh', '.h', '.cpp', '.cxx', '.arid', '.gradle', '.java', '.mk', '.md']), [])
|
|
47
38
|
self.allsrcpaths = [os.path.join(root, p) for p in self.relpaths(root, srcsuffixes, ['Dockerfile', 'Makefile'])]
|
|
48
39
|
self.docpaths = [p for p in self.allsrcpaths if p.endswith('.md')]
|
|
49
40
|
self.pypaths = [p for p in self.allsrcpaths if p.endswith('.py')]
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import hashlib, os, re, shlex, sys
|
|
2
2
|
|
|
3
|
-
gpltemplate = """# Copyright
|
|
3
|
+
gpltemplate = """# Copyright {years} {author}
|
|
4
4
|
|
|
5
|
-
# This file is part of
|
|
5
|
+
# This file is part of {name}.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
7
|
+
# {name} is free software: you can redistribute it and/or modify
|
|
8
8
|
# it under the terms of the GNU General Public License as published by
|
|
9
9
|
# the Free Software Foundation, either version 3 of the License, or
|
|
10
10
|
# (at your option) any later version.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
12
|
+
# {name} is distributed in the hope that it will be useful,
|
|
13
13
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
14
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
15
|
# GNU General Public License for more details.
|
|
16
16
|
#
|
|
17
17
|
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with
|
|
18
|
+
# along with {name}. If not, see <http://www.gnu.org/licenses/>.
|
|
19
19
|
"""
|
|
20
20
|
intersection = '''# This file incorporates work covered by the following copyright and
|
|
21
21
|
# permission notice:
|
|
22
22
|
'''
|
|
23
23
|
|
|
24
24
|
def _hassuffix(name, *suffixes):
|
|
25
|
-
return name.endswith(suffixes) or name.endswith(tuple("
|
|
25
|
+
return name.endswith(suffixes) or name.endswith(tuple(f"{s}.aridt" for s in suffixes))
|
|
26
26
|
|
|
27
27
|
def _checkmd5(info, name, expected):
|
|
28
28
|
licpath = os.path.join(info.projectdir, name)
|
|
@@ -41,11 +41,11 @@ def licheck(info, paths):
|
|
|
41
41
|
if sections:
|
|
42
42
|
sections.append(intersection)
|
|
43
43
|
if 'GPL' == name:
|
|
44
|
-
sections.append(gpltemplate
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
sections.append(gpltemplate.format(
|
|
45
|
+
years = ', '.join(map(str, info.config.years)),
|
|
46
|
+
author = info.config.author,
|
|
47
|
+
name = info.config.name,
|
|
48
|
+
))
|
|
49
49
|
elif 'MIT' == name:
|
|
50
50
|
with open(info.mitpath()) as f:
|
|
51
51
|
sections.append(''.join(('# ' if l.rstrip() else '#') + l for l in f))
|
|
@@ -37,7 +37,7 @@ def main():
|
|
|
37
37
|
try:
|
|
38
38
|
m = ast.parse(text)
|
|
39
39
|
except SyntaxError:
|
|
40
|
-
log.warning("Skip: %s"
|
|
40
|
+
log.warning("Skip: %s", relpath, exc_info = True)
|
|
41
41
|
continue
|
|
42
42
|
result = dict(
|
|
43
43
|
command = command,
|
|
@@ -50,7 +50,7 @@ def main():
|
|
|
50
50
|
if call.args or call.keywords:
|
|
51
51
|
log.warning("Bad call: %s", command)
|
|
52
52
|
else:
|
|
53
|
-
result['console_script'] = "
|
|
53
|
+
result['console_script'] = f"{command}={relpath[:-len(extension)].replace(os.sep, '.')}:{_funcpath(call.func)}"
|
|
54
54
|
print(result)
|
|
55
55
|
|
|
56
56
|
if ('__main__' == __name__):
|
|
@@ -17,7 +17,7 @@ def pipify(info, version = None):
|
|
|
17
17
|
if info.config.github.participant:
|
|
18
18
|
_, url = info.descriptionandurl()
|
|
19
19
|
elif info.config.pypi.participant:
|
|
20
|
-
url = "https://pypi.org/project
|
|
20
|
+
url = f"https://pypi.org/project/{info.config.name}/"
|
|
21
21
|
else:
|
|
22
22
|
raise Exception
|
|
23
23
|
else:
|
|
@@ -120,12 +120,12 @@ class InstallDeps:
|
|
|
120
120
|
yield j, True
|
|
121
121
|
continue
|
|
122
122
|
if self.localrepo is not None:
|
|
123
|
-
repopath = os.path.join(self.localrepo, "
|
|
123
|
+
repopath = os.path.join(self.localrepo, f"{name}.git")
|
|
124
124
|
if os.path.exists(repopath):
|
|
125
125
|
if self.siblings:
|
|
126
126
|
log.warning("Not a sibling, install from repo: %s", name)
|
|
127
127
|
clonepath = os.path.join(self.workspace, name)
|
|
128
|
-
subprocess.check_call(['git', 'clone', '--depth', '1', "file
|
|
128
|
+
subprocess.check_call(['git', 'clone', '--depth', '1', f"file://{repopath}", clonepath])
|
|
129
129
|
subprocess.check_call(['git', 'fetch', '--tags'], cwd = clonepath)
|
|
130
130
|
volatileprojects[name] = j = ProjectInfo.seek(clonepath)
|
|
131
131
|
yield j, False
|
|
@@ -152,7 +152,7 @@ class InstallDeps:
|
|
|
152
152
|
venv.install([i.projectdir for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
153
153
|
|
|
154
154
|
def cinvoke(self, container):
|
|
155
|
-
container.install(["/installdeps
|
|
155
|
+
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])
|
|
156
156
|
|
|
157
157
|
def __exit__(self, *exc_info):
|
|
158
158
|
shutil.rmtree(self.workspace)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from . import mainmodules
|
|
2
2
|
from .files import Files
|
|
3
|
-
from .util import
|
|
3
|
+
from .util import Seek
|
|
4
4
|
from aridity.config import ConfigCtrl
|
|
5
5
|
from aridity.model import Entry, Resource
|
|
6
6
|
from aridity.util import openresource
|
|
7
7
|
from inspect import getsource
|
|
8
|
+
from pathlib import Path
|
|
8
9
|
from pkg_resources import parse_requirements
|
|
9
10
|
from setuphacks import getsetupkwargs
|
|
10
11
|
from venvpool import ParsedRequires, TemporaryDirectory
|
|
@@ -42,7 +43,7 @@ class Req:
|
|
|
42
43
|
for r in cls.parselines(reqstrs):
|
|
43
44
|
try:
|
|
44
45
|
# FIXME: Allow running tests offline.
|
|
45
|
-
with urlopen(Request("https://pypi.org/simple
|
|
46
|
+
with urlopen(Request(f"https://pypi.org/simple/{quote(r.namepart, safe = '')}/", method = 'HEAD')):
|
|
46
47
|
pass
|
|
47
48
|
yield r
|
|
48
49
|
except HTTPError as e:
|
|
@@ -80,7 +81,7 @@ class Req:
|
|
|
80
81
|
|
|
81
82
|
def minstr(self):
|
|
82
83
|
version, = (s.version for s in self.specifierset if s.operator in {'>=', '=='})
|
|
83
|
-
return "
|
|
84
|
+
return f"{self.namepart}=={version}"
|
|
84
85
|
|
|
85
86
|
def accept(self):
|
|
86
87
|
marker = self.parsed.marker
|
|
@@ -106,7 +107,7 @@ class ProjectInfo:
|
|
|
106
107
|
|
|
107
108
|
@classmethod
|
|
108
109
|
def seek(cls, realdir):
|
|
109
|
-
path =
|
|
110
|
+
path = Seek.seek(realdir, cls.projectaridname)
|
|
110
111
|
if path is None:
|
|
111
112
|
raise ProjectInfoNotFoundException(realdir)
|
|
112
113
|
return cls(path.parent, path)
|
|
@@ -117,15 +118,19 @@ class ProjectInfo:
|
|
|
117
118
|
return cls.seek(realdir)
|
|
118
119
|
except ProjectInfoNotFoundException:
|
|
119
120
|
pass
|
|
120
|
-
setuppath =
|
|
121
|
+
setuppath = Seek.seek(realdir, 'setup.py')
|
|
121
122
|
if setuppath is not None:
|
|
122
123
|
log.info('Use setuptools mode.')
|
|
123
|
-
return
|
|
124
|
+
return _setuptoolsinfo(setuppath)
|
|
124
125
|
log.info('Use uninstallable mode.')
|
|
125
|
-
projectdir = os.path.dirname(
|
|
126
|
+
projectdir = os.path.dirname(Seek.seek(realdir, '.git'))
|
|
126
127
|
with openresource(__name__, 'setuptools.arid') as f:
|
|
127
128
|
info = cls(projectdir, f)
|
|
128
129
|
info.config.name = os.path.basename(os.path.abspath(projectdir))
|
|
130
|
+
try:
|
|
131
|
+
info.allrequires.extend((Path(projectdir) / 'requirements.txt').read_text().splitlines())
|
|
132
|
+
except FileNotFoundError:
|
|
133
|
+
pass
|
|
129
134
|
return info
|
|
130
135
|
|
|
131
136
|
def __init__(self, projectdir, infopathorstream):
|
|
@@ -153,7 +158,7 @@ class ProjectInfo:
|
|
|
153
158
|
import urllib.request, urllib.error, re, xml.dom.minidom as dom
|
|
154
159
|
pattern = re.compile('-([0-9]+)[-.]')
|
|
155
160
|
try:
|
|
156
|
-
with urllib.request.urlopen("https://pypi.org/simple
|
|
161
|
+
with urllib.request.urlopen(f"https://pypi.org/simple/{self.config.name}/") as f:
|
|
157
162
|
doc = dom.parseString(subprocess.check_output(['tidy', '-asxml'], input = f.read()))
|
|
158
163
|
last = max(int(pattern.search(textcontent(a)).group(1)) for a in doc.getElementsByTagName('a'))
|
|
159
164
|
except urllib.error.HTTPError as e:
|
|
@@ -164,11 +169,11 @@ class ProjectInfo:
|
|
|
164
169
|
|
|
165
170
|
def descriptionandurl(self):
|
|
166
171
|
import urllib.error, urllib.request, json, time
|
|
167
|
-
urlpath = "
|
|
172
|
+
urlpath = f"{self.config.github.account}/{self.config.name}"
|
|
168
173
|
while True:
|
|
169
174
|
try:
|
|
170
|
-
with urllib.request.urlopen("https://api.github.com/repos
|
|
171
|
-
return json.loads(f.read().decode())['description'], "https://github.com
|
|
175
|
+
with urllib.request.urlopen(f"https://api.github.com/repos/{urlpath}") as f:
|
|
176
|
+
return json.loads(f.read().decode())['description'], f"https://github.com/{urlpath}"
|
|
172
177
|
except urllib.error.HTTPError as e:
|
|
173
178
|
if 403 != e.code:
|
|
174
179
|
raise
|
|
@@ -187,7 +192,7 @@ class ProjectInfo:
|
|
|
187
192
|
f.write(getsource(mainmodules))
|
|
188
193
|
with open(os.path.join(tempdir, 'venvpool.py'), 'w') as f:
|
|
189
194
|
f.write(getsource(venvpool))
|
|
190
|
-
for line in subprocess.check_output(["python
|
|
195
|
+
for line in subprocess.check_output([f"python{next(iter(self.config.pyversions))}", scriptpath, self.projectdir] + paths).splitlines():
|
|
191
196
|
yield MainModule(eval(line))
|
|
192
197
|
|
|
193
198
|
def console_scripts(self):
|
|
@@ -195,7 +200,7 @@ class ProjectInfo:
|
|
|
195
200
|
|
|
196
201
|
def devversion(self):
|
|
197
202
|
releases = [int(t[1:]) for t in subprocess.check_output(['git', 'tag'], cwd = self.projectdir, universal_newlines = True).splitlines() if 'v' == t[0]]
|
|
198
|
-
return "
|
|
203
|
+
return f"{(max(releases) if releases else 0) + 1}.dev0"
|
|
199
204
|
|
|
200
205
|
class MainModule:
|
|
201
206
|
|
|
@@ -203,7 +208,7 @@ class MainModule:
|
|
|
203
208
|
for k, v in d.items():
|
|
204
209
|
setattr(self, k, v)
|
|
205
210
|
|
|
206
|
-
def
|
|
211
|
+
def _setuptoolsinfo(setuppath):
|
|
207
212
|
with openresource(__name__, 'setuptools.arid') as f:
|
|
208
213
|
info = ProjectInfo(os.path.dirname(setuppath), f)
|
|
209
214
|
setupkwargs = getsetupkwargs(setuppath, ['name', 'install_requires', 'entry_points'])
|
|
@@ -27,7 +27,7 @@ def _images():
|
|
|
27
27
|
i686 = Arch('linux32'),
|
|
28
28
|
x86_64 = Arch(None),
|
|
29
29
|
)
|
|
30
|
-
archmatch = re.compile("_(
|
|
30
|
+
archmatch = re.compile(f"_({'|'.join(map(re.escape, archlookup))})$").search
|
|
31
31
|
images = {
|
|
32
32
|
'manylinux_2_34_x86_64': '2024-11-23-da4547b',
|
|
33
33
|
'manylinux_2_28_x86_64': '2024-11-30-fa0d298',
|
|
@@ -43,8 +43,8 @@ class Image:
|
|
|
43
43
|
|
|
44
44
|
@singleton
|
|
45
45
|
def pythonexe():
|
|
46
|
-
impl = "cp
|
|
47
|
-
return "/opt/python
|
|
46
|
+
impl = f"cp{sysconfig.get_config_var('py_version_nodot')}"
|
|
47
|
+
return f"/opt/python/{impl}-{impl}{sys.abiflags}/bin/python"
|
|
48
48
|
|
|
49
49
|
def __init__(self, imagetag, plat, arch):
|
|
50
50
|
self.imagetag = imagetag
|
|
@@ -54,25 +54,24 @@ class Image:
|
|
|
54
54
|
def makewheels(self, info): # TODO: This code would benefit from modern syntax.
|
|
55
55
|
from lagoon import docker
|
|
56
56
|
from lagoon.program import NOEOL
|
|
57
|
-
docker_print = docker[partial](stdout = None)
|
|
58
57
|
log.info("Make wheels for platform: %s", self.plat)
|
|
59
58
|
scripts = list(info.config.devel.scripts)
|
|
60
59
|
packages = list(info.config.devel.packages)
|
|
61
60
|
# TODO: Copy not mount so we can run containers in parallel.
|
|
62
|
-
with bgcontainer('-v', "
|
|
61
|
+
with bgcontainer('-v', f"{info.projectdir}:/io", f"{self.prefix}{self.plat}:{self.imagetag}") as container:
|
|
63
62
|
def run(execargs, command):
|
|
64
|
-
|
|
63
|
+
docker.exec[print](*execargs, container, *self.arch.entrypoint, *command)
|
|
65
64
|
if packages:
|
|
66
65
|
run([], chain(['yum', 'install', '-y'], packages))
|
|
67
66
|
for script in scripts:
|
|
68
67
|
# TODO LATER: Run as ordinary sudo-capable user.
|
|
69
|
-
dirpath = docker[NOEOL](
|
|
68
|
+
dirpath = docker.exec[NOEOL](container, 'mktemp', '-d') # No need to cleanup, will die with container.
|
|
70
69
|
log.debug("In container dir %s run script: %s", dirpath, script)
|
|
71
70
|
run(['-w', dirpath, '-t'], ['sh', '-c', script])
|
|
72
|
-
|
|
71
|
+
docker.cp[print](resource_filename(__name__, 'patchpolicy.py'), f"{container}:/patchpolicy.py")
|
|
73
72
|
run([], [self.pythonexe, '/patchpolicy.py'])
|
|
74
|
-
|
|
75
|
-
run(['-u', "
|
|
73
|
+
docker.cp[print](resource_filename(__name__, 'bdist.py'), f"{container}:/bdist.py")
|
|
74
|
+
run(['-u', f"{os.geteuid()}:{os.getegid()}", '-w', '/io'], chain([self.pythonexe, '/bdist.py', '--plat', self.plat], info.config.pyversions))
|
|
76
75
|
|
|
77
76
|
def main():
|
|
78
77
|
initlogging()
|
|
@@ -119,7 +118,7 @@ def _warmups(info):
|
|
|
119
118
|
with InstallDeps(info, False, None) as installdeps, Pool(next(iter(info.config.pyversions))).readonlyortransient[True](installdeps) as venv:
|
|
120
119
|
for m, f in warmups:
|
|
121
120
|
with NamedTemporaryFile('w', suffix = dotpy, dir = info.projectdir) as script:
|
|
122
|
-
script.write("from
|
|
121
|
+
script.write(f"from {m} import {f.split('.')[0]}\n{f}()")
|
|
123
122
|
script.flush()
|
|
124
123
|
venv.run('check_call', ['.'] + installdeps.localreqs, os.path.basename(script.name)[:-len(dotpy)], [], cwd = info.projectdir)
|
|
125
124
|
|
|
@@ -128,7 +127,7 @@ def _runsetup(info, commands):
|
|
|
128
127
|
venv.run('check_call', ['.'], 'setup', commands, cwd = info.projectdir) # XXX: Should venvpool automatically include current dir?
|
|
129
128
|
|
|
130
129
|
def release(config, srcgit, info):
|
|
131
|
-
scrub = lagoon.git.clean._xdi[partial](cwd = info.projectdir, input = 'c'
|
|
130
|
+
scrub = lagoon.git.clean._xdi[partial, print](cwd = info.projectdir, input = 'c')
|
|
132
131
|
scrub()
|
|
133
132
|
version = info.nextversion()
|
|
134
133
|
pipify(info, version)
|
|
@@ -152,11 +151,11 @@ def release(config, srcgit, info):
|
|
|
152
151
|
_runsetup(info, setupcommands + ['sdist'])
|
|
153
152
|
artifactrelpaths = [os.path.join(distrelpath, name) for name in sorted(os.listdir(os.path.join(info.projectdir, distrelpath)))]
|
|
154
153
|
if config.upload:
|
|
155
|
-
srcgit.tag("v
|
|
154
|
+
srcgit.tag[print](f"v{version}")
|
|
156
155
|
# TODO LATER: If tag succeeded but push fails, we're left with a bogus tag.
|
|
157
|
-
srcgit.push.__tags(
|
|
156
|
+
srcgit.push.__tags[print]() # XXX: Also update other remotes?
|
|
158
157
|
with config.token as token:
|
|
159
|
-
Program.text(sys.executable)._m.twine.upload('-u', '__token__', '-p', token, *uploadableartifacts(artifactrelpaths), cwd = info.projectdir,
|
|
158
|
+
Program.text(sys.executable)._m.twine.upload[print]('-u', '__token__', '-p', token, *uploadableartifacts(artifactrelpaths), cwd = info.projectdir, env = Pip.envpatch)
|
|
160
159
|
else:
|
|
161
160
|
log.warning("Upload skipped, use --upload to upload: %s", ' '.join(uploadableartifacts(artifactrelpaths)))
|
|
162
161
|
return artifactrelpaths
|
|
@@ -8,7 +8,7 @@ class SourceInfo:
|
|
|
8
8
|
|
|
9
9
|
def make_ext(self):
|
|
10
10
|
g = {}
|
|
11
|
-
with open("
|
|
11
|
+
with open(f"{self.path}bld") as f: # Assume project root.
|
|
12
12
|
exec(f.read(), g)
|
|
13
13
|
return g['make_ext'](self.module, self.path)
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ class SourceInfo:
|
|
|
16
16
|
def addextpaths(dirpath, moduleprefix, suffix = '.pyx'):
|
|
17
17
|
for name in sorted(os.listdir(os.path.join(rootdir, dirpath))):
|
|
18
18
|
if name.endswith(suffix):
|
|
19
|
-
module = "
|
|
19
|
+
module = f"{moduleprefix}{name[:-len(suffix)]}"
|
|
20
20
|
if module not in extpaths:
|
|
21
21
|
extpaths[module] = self.PYXPath(module, os.path.join(dirpath, name))
|
|
22
22
|
from setuptools import find_packages
|
|
@@ -25,7 +25,7 @@ class SourceInfo:
|
|
|
25
25
|
extpaths = {}
|
|
26
26
|
addextpaths('.', '')
|
|
27
27
|
for package in self.packages:
|
|
28
|
-
addextpaths(package.replace('.', os.sep), "
|
|
28
|
+
addextpaths(package.replace('.', os.sep), f"{package}.")
|
|
29
29
|
self.extpaths = extpaths.values()
|
|
30
30
|
|
|
31
31
|
def setup_kwargs(self):
|
|
@@ -19,20 +19,20 @@ def main():
|
|
|
19
19
|
return
|
|
20
20
|
project = headinfo.config.name
|
|
21
21
|
# XXX: When building a tag use that same version?
|
|
22
|
-
with urlopen("https://pypi.org/rss/project
|
|
22
|
+
with urlopen(f"https://pypi.org/rss/project/{project}/releases.xml") as f:
|
|
23
23
|
version = ET.parse(f).find('./channel/item/title').text
|
|
24
|
-
req = "
|
|
24
|
+
req = f"{project}=={version}"
|
|
25
25
|
upstream_devel_packages = list(headinfo.config.upstream.devel.packages)
|
|
26
26
|
for pyversion in reversed(pyversiontags[3]): # XXX: Why only 3?
|
|
27
27
|
log.info("Python version: %s", pyversion)
|
|
28
|
-
with bgcontainer("python
|
|
29
|
-
containerexec = docker[partial](
|
|
28
|
+
with bgcontainer(f"python:{pyversion}") as container:
|
|
29
|
+
containerexec = docker.exec[partial, print](container)
|
|
30
30
|
if upstream_devel_packages:
|
|
31
31
|
initapt(containerexec)
|
|
32
32
|
containerexec('apt-get', 'update')
|
|
33
33
|
containerexec('apt-get', 'install', '-y', *upstream_devel_packages)
|
|
34
34
|
containerexec('pip', 'install', req)
|
|
35
|
-
git.checkout("v
|
|
35
|
+
git.checkout[print](f"v{version}")
|
|
36
36
|
EveryVersion(ProjectInfo.seek('.'), False, False, [], True, True).nose()
|
|
37
37
|
|
|
38
38
|
if '__main__' == __name__:
|
|
@@ -7,20 +7,16 @@ def stderr(obj):
|
|
|
7
7
|
sys.stderr.write(str(obj))
|
|
8
8
|
sys.stderr.write(os.linesep)
|
|
9
9
|
|
|
10
|
-
def stripeol(line):
|
|
11
|
-
line, = line.splitlines()
|
|
12
|
-
return line
|
|
13
|
-
|
|
14
10
|
class Excludes:
|
|
15
11
|
|
|
16
12
|
def __init__(self, globs):
|
|
17
13
|
def disjunction():
|
|
18
14
|
sep = re.escape(os.sep)
|
|
19
|
-
star = "[
|
|
15
|
+
star = f"[^{sep}]*"
|
|
20
16
|
def components():
|
|
21
17
|
for word in glob.split('/'):
|
|
22
18
|
if '**' == word:
|
|
23
|
-
yield "(
|
|
19
|
+
yield f"(?:{star}{sep})*"
|
|
24
20
|
else:
|
|
25
21
|
yield star.join(re.escape(part) for part in word.split('*'))
|
|
26
22
|
yield sep
|
|
@@ -28,12 +24,12 @@ class Excludes:
|
|
|
28
24
|
concat = ''.join(components())
|
|
29
25
|
assert concat.endswith(sep)
|
|
30
26
|
yield concat[:-len(sep)]
|
|
31
|
-
self.pattern = re.compile("
|
|
27
|
+
self.pattern = re.compile(f"^{'|'.join(disjunction())}$")
|
|
32
28
|
|
|
33
29
|
def __contains__(self, relpath):
|
|
34
30
|
return self.pattern.search(relpath) is not None
|
|
35
31
|
|
|
36
|
-
class
|
|
32
|
+
class Seek(str):
|
|
37
33
|
|
|
38
34
|
@classmethod
|
|
39
35
|
def seek(cls, dirpath, name):
|
|
@@ -47,26 +43,6 @@ class Path(str):
|
|
|
47
43
|
break
|
|
48
44
|
dirpath = parent
|
|
49
45
|
|
|
50
|
-
class ThreadPoolExecutor:
|
|
51
|
-
|
|
52
|
-
def __enter__(self):
|
|
53
|
-
return self
|
|
54
|
-
|
|
55
|
-
def submit(self, f, *args, **kwargs):
|
|
56
|
-
class Task:
|
|
57
|
-
def result(self):
|
|
58
|
-
return f(*args, **kwargs)
|
|
59
|
-
return Task()
|
|
60
|
-
|
|
61
|
-
def __exit__(self, *exc_info):
|
|
62
|
-
pass
|
|
63
|
-
|
|
64
|
-
assert ThreadPoolExecutor
|
|
65
|
-
try:
|
|
66
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
67
|
-
except ImportError:
|
|
68
|
-
pass
|
|
69
|
-
|
|
70
46
|
@contextmanager
|
|
71
47
|
def bgcontainer(*dockerrunargs):
|
|
72
48
|
from lagoon import docker
|
|
@@ -75,7 +51,7 @@ def bgcontainer(*dockerrunargs):
|
|
|
75
51
|
try:
|
|
76
52
|
yield container
|
|
77
53
|
finally:
|
|
78
|
-
docker.rm._f(container
|
|
54
|
+
docker.rm._f[print](container)
|
|
79
55
|
|
|
80
56
|
def initapt(dockerexec):
|
|
81
57
|
dockerexec('mkdir', '-pv', '/etc/apt/keyrings')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 102
|
|
4
4
|
Summary: Manage development of multiple Python projects
|
|
5
5
|
Home-page: https://pypi.org/project/pyven/
|
|
6
6
|
Author: Homsar
|
|
@@ -19,12 +19,6 @@ Manage development of multiple Python projects
|
|
|
19
19
|
|
|
20
20
|
## Commands
|
|
21
21
|
|
|
22
|
-
### drmake
|
|
23
|
-
Build a Docker image with automatic tag.
|
|
24
|
-
|
|
25
|
-
### launch
|
|
26
|
-
Run project using a suitable venv from the pool.
|
|
27
|
-
|
|
28
22
|
### minreqs
|
|
29
23
|
Pin requires to their minimum allowed versions.
|
|
30
24
|
|
{pyven-100 → pyven-102}/setup.py
RENAMED
|
@@ -14,7 +14,7 @@ class SourceInfo:
|
|
|
14
14
|
|
|
15
15
|
def make_ext(self):
|
|
16
16
|
g = {}
|
|
17
|
-
with open("
|
|
17
|
+
with open(f"{self.path}bld") as f: # Assume project root.
|
|
18
18
|
exec(f.read(), g)
|
|
19
19
|
return g['make_ext'](self.module, self.path)
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ class SourceInfo:
|
|
|
22
22
|
def addextpaths(dirpath, moduleprefix, suffix = '.pyx'):
|
|
23
23
|
for name in sorted(os.listdir(os.path.join(rootdir, dirpath))):
|
|
24
24
|
if name.endswith(suffix):
|
|
25
|
-
module = "
|
|
25
|
+
module = f"{moduleprefix}{name[:-len(suffix)]}"
|
|
26
26
|
if module not in extpaths:
|
|
27
27
|
extpaths[module] = self.PYXPath(module, os.path.join(dirpath, name))
|
|
28
28
|
from setuptools import find_packages
|
|
@@ -31,7 +31,7 @@ class SourceInfo:
|
|
|
31
31
|
extpaths = {}
|
|
32
32
|
addextpaths('.', '')
|
|
33
33
|
for package in self.packages:
|
|
34
|
-
addextpaths(package.replace('.', os.sep), "
|
|
34
|
+
addextpaths(package.replace('.', os.sep), f"{package}.")
|
|
35
35
|
self.extpaths = extpaths.values()
|
|
36
36
|
|
|
37
37
|
def setup_kwargs(self):
|
|
@@ -44,7 +44,7 @@ class SourceInfo:
|
|
|
44
44
|
sourceinfo = SourceInfo('.')
|
|
45
45
|
setup(
|
|
46
46
|
name = 'pyven',
|
|
47
|
-
version = '
|
|
47
|
+
version = '102',
|
|
48
48
|
description = 'Manage development of multiple Python projects',
|
|
49
49
|
long_description = long_description(),
|
|
50
50
|
long_description_content_type = 'text/markdown',
|
|
@@ -54,6 +54,6 @@ setup(
|
|
|
54
54
|
py_modules = [],
|
|
55
55
|
install_requires = ['aridity>=77', 'diapyr>=31', 'lagoon>=24', 'pydoc-markdown>=3.3', 'setuptools>=44.1.1', 'twine>=1.15.0', 'venvpool>=14'],
|
|
56
56
|
package_data = {'': ['*.pxd', '*.pyx', '*.pyxbld', '*.arid', '*.aridt']},
|
|
57
|
-
entry_points = {'console_scripts': ['
|
|
57
|
+
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']},
|
|
58
58
|
**sourceinfo.setup_kwargs(),
|
|
59
59
|
)
|
pyven-100/pyven/drmake.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'Build a Docker image with automatic tag.'
|
|
2
|
-
from .projectinfo import ProjectInfo
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
def main():
|
|
6
|
-
info = ProjectInfo.seek('.')
|
|
7
|
-
command = 'docker', 'build', '-t', info.config.docker.tag, info.projectdir
|
|
8
|
-
os.execvp(command[0], command)
|
|
9
|
-
|
|
10
|
-
if '__main__' == __name__:
|
|
11
|
-
main()
|
pyven-100/pyven/launch.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'Run project using a suitable venv from the pool.'
|
|
2
|
-
from .pipify import InstallDeps
|
|
3
|
-
from .projectinfo import ProjectInfo
|
|
4
|
-
from argparse import ArgumentParser
|
|
5
|
-
from venvpool import initlogging, Pool
|
|
6
|
-
import subprocess, sys
|
|
7
|
-
|
|
8
|
-
def main(): # TODO: Retire in favour of venvpool module.
|
|
9
|
-
initlogging()
|
|
10
|
-
parser = ArgumentParser()
|
|
11
|
-
parser.add_argument('--build', action = 'store_true', help = 'rebuild native components')
|
|
12
|
-
args = parser.parse_args()
|
|
13
|
-
info = ProjectInfo.seekany('.')
|
|
14
|
-
_, objref = next(iter(info.console_scripts())).split('=') # XXX: Support more than just the first?
|
|
15
|
-
modulename, qname = objref.split(':')
|
|
16
|
-
with InstallDeps(info, False, None) as installdeps, Pool(sys.version_info.major).readonlyorreadwrite[args.build](installdeps) as venv:
|
|
17
|
-
if args.build:
|
|
18
|
-
venv.install(['--no-deps', '-e', info.projectdir]) # XXX: Can this be done without venv install?
|
|
19
|
-
status = subprocess.call([venv.programpath('python'), '-c', "from %s import %s; %s()" % (modulename, qname.split('.')[0], qname)])
|
|
20
|
-
sys.exit(status)
|
|
21
|
-
|
|
22
|
-
if '__main__' == __name__:
|
|
23
|
-
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
|