pyven 103__tar.gz → 105__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-103 → pyven-105}/PKG-INFO +1 -1
- {pyven-103 → pyven-105}/pyven/checks.py +20 -21
- {pyven-103 → pyven-105}/pyven/files.py +12 -21
- {pyven-103 → pyven-105}/pyven/licheck.py +9 -9
- pyven-105/pyven/metacheck.py +49 -0
- pyven-105/pyven/minreqs.py +22 -0
- {pyven-103 → pyven-105}/pyven/nlcheck.py +1 -1
- {pyven-103 → pyven-105}/pyven/pipify.py +20 -22
- {pyven-103 → pyven-105}/pyven/projectinfo.py +19 -16
- {pyven-103 → pyven-105}/pyven/release.arid +1 -0
- {pyven-103 → pyven-105}/pyven/release.py +11 -12
- {pyven-103 → pyven-105}/pyven/setup.py.aridt +0 -7
- {pyven-103 → pyven-105}/pyven/sourceinfo.py +13 -3
- {pyven-103 → pyven-105}/pyven/tryinstall.py +1 -1
- {pyven-103 → pyven-105}/pyven/util.py +10 -6
- {pyven-103 → pyven-105}/pyven.egg-info/PKG-INFO +1 -1
- {pyven-103 → pyven-105}/pyven.egg-info/SOURCES.txt +1 -0
- {pyven-103 → pyven-105}/setup.py +13 -10
- pyven-103/pyven/minreqs.py +0 -15
- {pyven-103 → pyven-105}/README.md +0 -0
- {pyven-103 → pyven-105}/pyven/README.md.aridt +0 -0
- {pyven-103 → pyven-105}/pyven/__init__.py +0 -0
- {pyven-103 → pyven-105}/pyven/bdist.py +0 -0
- {pyven-103 → pyven-105}/pyven/divcheck.py +0 -0
- {pyven-103 → pyven-105}/pyven/execcheck.py +0 -0
- {pyven-103 → pyven-105}/pyven/functions.py +0 -0
- {pyven-103 → pyven-105}/pyven/mainmodules.py +0 -0
- {pyven-103 → pyven-105}/pyven/patchpolicy.py +0 -0
- {pyven-103 → pyven-105}/pyven/projectinfo.arid +0 -0
- {pyven-103 → pyven-105}/pyven/pyproject.toml.aridt +0 -0
- {pyven-103 → pyven-105}/pyven/setup.cfg.aridt +0 -0
- {pyven-103 → pyven-105}/pyven/setuptools.arid +0 -0
- {pyven-103 → pyven-105}/pyven/tasks.py +0 -0
- {pyven-103 → pyven-105}/pyven/tests/__init__.py +0 -0
- {pyven-103 → pyven-105}/pyven.egg-info/dependency_links.txt +0 -0
- {pyven-103 → pyven-105}/pyven.egg-info/entry_points.txt +0 -0
- {pyven-103 → pyven-105}/pyven.egg-info/requires.txt +0 -0
- {pyven-103 → pyven-105}/pyven.egg-info/top_level.txt +0 -0
- {pyven-103 → pyven-105}/setup.cfg +0 -0
{pyven-103 → pyven-105}/PKG-INFO
RENAMED
|
@@ -51,9 +51,12 @@ class EveryVersion:
|
|
|
51
51
|
self.docker = docker
|
|
52
52
|
self.transient = transient
|
|
53
53
|
|
|
54
|
-
def allchecks(self):
|
|
55
|
-
for check in self.licheck, self.nlcheck, self.execcheck, self.
|
|
56
|
-
check
|
|
54
|
+
def allchecks(self, exclude = ()):
|
|
55
|
+
for check in self.licheck, self.nlcheck, self.execcheck, self.metacheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
|
|
56
|
+
if check.__name__ in exclude:
|
|
57
|
+
log.warning("Exclude: %s", check.__name__)
|
|
58
|
+
else:
|
|
59
|
+
check()
|
|
57
60
|
|
|
58
61
|
def licheck(self):
|
|
59
62
|
from .licheck import licheck
|
|
@@ -72,13 +75,9 @@ class EveryVersion:
|
|
|
72
75
|
from .execcheck import execcheck
|
|
73
76
|
_runcheck('*', execcheck, self.files.pypaths)
|
|
74
77
|
|
|
75
|
-
def
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if not expected:
|
|
79
|
-
expected = '# This file blank.\n'
|
|
80
|
-
assert expected == Path(self.info.projectdir, 'requirements.txt').read_text()
|
|
81
|
-
_runcheck('*', reqscheck)
|
|
78
|
+
def metacheck(self):
|
|
79
|
+
from .metacheck import metacheck
|
|
80
|
+
_runcheck('*', metacheck, self.info.projectdir, self.info.devversion(), self.docker)
|
|
82
81
|
|
|
83
82
|
def divcheck(self):
|
|
84
83
|
from . import divcheck
|
|
@@ -91,7 +90,7 @@ class EveryVersion:
|
|
|
91
90
|
_runcheck(pyversion, divcheck)
|
|
92
91
|
|
|
93
92
|
def pyflakes(self):
|
|
94
|
-
paths = [path for excludes in [Excludes(self.info.config.flakes.exclude.globs)]
|
|
93
|
+
paths = [str(path) for excludes in [Excludes(self.info.config.flakes.exclude.globs)]
|
|
95
94
|
for path in self.files.pypaths if os.path.relpath(path, self.files.root) not in excludes]
|
|
96
95
|
def pyflakes():
|
|
97
96
|
if paths:
|
|
@@ -106,11 +105,11 @@ class EveryVersion:
|
|
|
106
105
|
with InstallDeps(self.info, self.siblings, _localrepo() if self.userepo else None) as installdeps:
|
|
107
106
|
installdeps.add('nose-cov', *self.info.config.test.requires) # TODO: Facility to freeze test requires tree.
|
|
108
107
|
for pyversion in self.info.config.pyversions:
|
|
109
|
-
reportsdir =
|
|
110
|
-
|
|
111
|
-
xmlpath =
|
|
108
|
+
reportsdir = self.info.projectdir / 'var' / str(pyversion)
|
|
109
|
+
reportsdir.mkdir(exist_ok = True, parents = True)
|
|
110
|
+
xmlpath = reportsdir / 'nosetests.xml'
|
|
112
111
|
if self.docker:
|
|
113
|
-
coveragepath =
|
|
112
|
+
coveragepath = self.info.projectdir / '.coverage'
|
|
114
113
|
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:
|
|
115
114
|
container = Container(container)
|
|
116
115
|
container.cp(installdeps.workspace, 'installdeps')
|
|
@@ -132,7 +131,7 @@ class EveryVersion:
|
|
|
132
131
|
'--with-cov', '--cov-report', 'term-missing',
|
|
133
132
|
] + 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)
|
|
134
133
|
else:
|
|
135
|
-
coveragepath = '.coverage'
|
|
134
|
+
coveragepath = Path('.coverage')
|
|
136
135
|
with Pool(pyversion).readonlyortransient[self.transient](installdeps) as venv:
|
|
137
136
|
status = venv.run('call', installdeps.localreqs, Task('''import collections
|
|
138
137
|
try:
|
|
@@ -144,10 +143,10 @@ except AttributeError:
|
|
|
144
143
|
'--with-doctest', '--doctest-extension', '.md',
|
|
145
144
|
'--with-xunit', '--xunit-file', xmlpath,
|
|
146
145
|
'--with-cov', '--cov-report', 'term-missing',
|
|
147
|
-
] + sum((['--cov', p] for p in chain(find_packages(self.info.projectdir), self.info.py_modules())), []) + self.files.testpaths(xmlpath) + self.noseargs)
|
|
148
|
-
if
|
|
149
|
-
copy2(coveragepath,
|
|
150
|
-
|
|
146
|
+
] + 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)
|
|
147
|
+
if coveragepath.exists():
|
|
148
|
+
copy2(coveragepath, reportsdir / 'coverage') # Replace whatever the status, as if we configured the location.
|
|
149
|
+
coveragepath.unlink() # Can't simply use rename cross-device in release case.
|
|
151
150
|
assert not status
|
|
152
151
|
|
|
153
152
|
def readme(self):
|
|
@@ -197,7 +196,7 @@ except AttributeError:
|
|
|
197
196
|
with openresource(__name__, 'README.md.aridt') as f:
|
|
198
197
|
(-config).processtemplate(f, g)
|
|
199
198
|
g.flush()
|
|
200
|
-
completed = diff(g.name,
|
|
199
|
+
completed = diff(g.name, self.info.projectdir / 'README.md', check = False)
|
|
201
200
|
sys.stdout.write(completed.stdout)
|
|
202
201
|
assert completed.returncode in {0, 1}
|
|
203
202
|
assert all('<' != l[0] for l in completed.stdout.splitlines())
|
|
@@ -1,53 +1,44 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
2
|
from lagoon import git
|
|
3
3
|
from lagoon.program import partial
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from venvpool import dotpy
|
|
4
6
|
import xml.dom.minidom as dom, os
|
|
5
7
|
|
|
6
8
|
class Files:
|
|
7
9
|
|
|
8
10
|
@staticmethod
|
|
9
11
|
def _findfiles(walkpath, suffixes, prefixes):
|
|
10
|
-
def acceptname():
|
|
11
|
-
for suffix in suffixes:
|
|
12
|
-
if name.endswith(suffix):
|
|
13
|
-
return True
|
|
14
|
-
for prefix in prefixes:
|
|
15
|
-
if name.startswith(prefix):
|
|
16
|
-
return True
|
|
17
|
-
prefixlen = len(walkpath + os.sep)
|
|
18
12
|
for dirpath, dirnames, filenames in os.walk(walkpath):
|
|
19
13
|
for name in sorted(filenames):
|
|
20
|
-
if
|
|
21
|
-
yield
|
|
14
|
+
if any(name.endswith(suffix) for suffix in suffixes) or any(name.startswith(prefix) for prefix in prefixes):
|
|
15
|
+
yield Path(dirpath, name).relative_to(walkpath)
|
|
22
16
|
dirnames.sort()
|
|
23
17
|
|
|
24
18
|
@classmethod
|
|
25
19
|
def relpaths(cls, root, suffixes, prefixes):
|
|
26
20
|
paths = list(cls._findfiles(root, suffixes, prefixes))
|
|
27
|
-
if os.path.exists(os.path.join(root, '.gitmodules')):
|
|
28
|
-
for submoduleslash in (l.split(' ', 1)[1] + os.sep for l in git.config('--file', '.gitmodules', '--get-regexp', '^submodule[.].+[.]path$', cwd = root).splitlines()):
|
|
29
|
-
paths = [p for p in paths if not p.startswith(submoduleslash)]
|
|
30
21
|
if paths:
|
|
31
22
|
with git.check_ignore[partial](*paths, check = False, cwd = root) as p:
|
|
32
23
|
ignored = set(p.stdout.read().splitlines())
|
|
33
24
|
assert p.wait() in [0, 1]
|
|
34
25
|
for path in paths:
|
|
35
|
-
if path not in ignored:
|
|
26
|
+
if str(path) not in ignored:
|
|
36
27
|
yield path
|
|
37
28
|
|
|
38
29
|
def __init__(self, root):
|
|
39
|
-
srcsuffixes =
|
|
40
|
-
self.allsrcpaths = [
|
|
41
|
-
self.docpaths = [p for p in self.allsrcpaths if p.endswith('.md')]
|
|
42
|
-
self.pypaths = [p for p in self.allsrcpaths if p.endswith('.py')]
|
|
30
|
+
srcsuffixes = [x for s in ['.py', '.py3', '.pyx', '.s', '.sh', '.h', '.cpp', '.cxx', '.arid', '.gradle', '.java', '.mk', '.md'] for x in [s, f"{s}.aridt"]]
|
|
31
|
+
self.allsrcpaths = [root / p for p in self.relpaths(root, srcsuffixes, ['Dockerfile', 'Makefile'])]
|
|
32
|
+
self.docpaths = [p for p in self.allsrcpaths if p.name.endswith('.md')]
|
|
33
|
+
self.pypaths = [p for p in self.allsrcpaths if p.name.endswith('.py')]
|
|
43
34
|
self.root = root
|
|
44
35
|
|
|
45
36
|
def testpaths(self, reportpath):
|
|
46
37
|
paths = [p for p in self.pypaths if os.path.basename(p).startswith('test_')] + self.docpaths
|
|
47
|
-
if
|
|
48
|
-
with open(
|
|
38
|
+
if reportpath.exists():
|
|
39
|
+
with reportpath.open() as f:
|
|
49
40
|
doc = dom.parse(f)
|
|
50
|
-
nametopath =
|
|
41
|
+
nametopath = {'.'.join(p.relative_to(self.root).parts)[:-len(dotpy)]: p for p in paths} # FIXME: Correctly handle docpaths.
|
|
51
42
|
pathtotime = defaultdict(int)
|
|
52
43
|
for e in doc.getElementsByTagName('testcase'):
|
|
53
44
|
name = e.getAttribute('classname')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import hashlib,
|
|
1
|
+
import hashlib, re, shlex, sys
|
|
2
2
|
|
|
3
3
|
gpltemplate = """# Copyright {years} {author}
|
|
4
4
|
|
|
@@ -25,9 +25,9 @@ def _hassuffix(name, *suffixes):
|
|
|
25
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
|
-
licpath =
|
|
28
|
+
licpath = info.projectdir / name
|
|
29
29
|
md5 = hashlib.md5()
|
|
30
|
-
with open(
|
|
30
|
+
with licpath.open() as f:
|
|
31
31
|
md5.update(f.read().encode('utf_8'))
|
|
32
32
|
if expected != md5.hexdigest():
|
|
33
33
|
raise Exception(licpath)
|
|
@@ -47,7 +47,7 @@ def licheck(info, paths):
|
|
|
47
47
|
name = info.config.name,
|
|
48
48
|
))
|
|
49
49
|
elif 'MIT' == name:
|
|
50
|
-
with
|
|
50
|
+
with info.mitpath().open() as f:
|
|
51
51
|
sections.append(''.join(('# ' if l.rstrip() else '#') + l for l in f))
|
|
52
52
|
elif 'UNLICENSE' == name:
|
|
53
53
|
pass
|
|
@@ -55,21 +55,21 @@ def licheck(info, paths):
|
|
|
55
55
|
raise Exception(name)
|
|
56
56
|
master = ''.join(s + '\n' for s in sections) # Check each section ends with 2 newlines.
|
|
57
57
|
def checkone(path):
|
|
58
|
-
with open(
|
|
58
|
+
with path.open() as f:
|
|
59
59
|
text = f.read()
|
|
60
60
|
if text.startswith('#!'):
|
|
61
61
|
for _ in range(2):
|
|
62
62
|
text = text[text.index('\n') + 1:]
|
|
63
|
-
if _hassuffix(path, '.s'):
|
|
63
|
+
if _hassuffix(path.name, '.s'):
|
|
64
64
|
text = re.sub('^;', '#', text, flags = re.MULTILINE)
|
|
65
|
-
elif _hassuffix(path, '.h', '.cpp', '.cxx', '.gradle', '.java'):
|
|
65
|
+
elif _hassuffix(path.name, '.h', '.cpp', '.cxx', '.gradle', '.java'):
|
|
66
66
|
text = re.sub('^//', '#', text, flags = re.MULTILINE)
|
|
67
|
-
elif _hassuffix(path, '.arid'):
|
|
67
|
+
elif _hassuffix(path.name, '.arid'):
|
|
68
68
|
text = re.sub('^:', '#', text, flags = re.MULTILINE)
|
|
69
69
|
return master == text[:len(master)]
|
|
70
70
|
badpaths = [p for p in paths if not checkone(p)]
|
|
71
71
|
if badpaths:
|
|
72
|
-
raise Exception(' '.join(map(shlex.quote, badpaths)))
|
|
72
|
+
raise Exception(' '.join(map(shlex.quote, map(str, badpaths))))
|
|
73
73
|
if 'GPL' in info.config.licenses:
|
|
74
74
|
_checkmd5(info, 'COPYING', 'd32239bcb673463ab874e80d47fae504')
|
|
75
75
|
if 'UNLICENSE' in info.config.licenses:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from .checks import Container
|
|
2
|
+
from .pipify import pipify, setupcommand
|
|
3
|
+
from .projectinfo import ProjectInfo
|
|
4
|
+
from .util import bgcontainer, pyversiontags
|
|
5
|
+
from contextlib import contextmanager
|
|
6
|
+
from lagoon import diff
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from shutil import copy2
|
|
9
|
+
from tempfile import TemporaryDirectory
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
@contextmanager
|
|
13
|
+
def egginfodir(projectdir, version, dockerenabled):
|
|
14
|
+
with TemporaryDirectory() as tempdir:
|
|
15
|
+
copy2(projectdir / 'project.arid', tempdir)
|
|
16
|
+
try:
|
|
17
|
+
copy2(projectdir / 'README.md', tempdir)
|
|
18
|
+
except FileNotFoundError:
|
|
19
|
+
pass
|
|
20
|
+
copyinfo = ProjectInfo.seek(tempdir)
|
|
21
|
+
pipify(copyinfo, version)
|
|
22
|
+
if dockerenabled and {'setuptools', 'wheel'} != set(copyinfo.allbuildrequires):
|
|
23
|
+
with bgcontainer('-v', f"{tempdir}:{Container.workdir}", f"python:{pyversiontags[3][0]}") as container:
|
|
24
|
+
container = Container(container)
|
|
25
|
+
container.inituser()
|
|
26
|
+
for command in ['apt-get', 'update'], ['apt-get', 'install', '-y', 'sudo']:
|
|
27
|
+
container.call(command, check = True, root = True)
|
|
28
|
+
container.call(['pip', 'install', '--upgrade', 'setuptools'], check = True, root = True)
|
|
29
|
+
container.call(['pip', 'install', *copyinfo.allbuildrequires], check = True, root = True)
|
|
30
|
+
container.call(['python', 'setup.py', 'egg_info'], check = True)
|
|
31
|
+
else:
|
|
32
|
+
setupcommand(copyinfo, 3, False, 'egg_info')
|
|
33
|
+
d, = Path(tempdir).glob('*.egg-info')
|
|
34
|
+
yield tempdir, d
|
|
35
|
+
|
|
36
|
+
def metacheck(projectdir, version, dockerenabled):
|
|
37
|
+
with egginfodir(projectdir, version, dockerenabled) as (tempdir, d):
|
|
38
|
+
p = d / 'requires.txt'
|
|
39
|
+
q = projectdir / p.relative_to(tempdir)
|
|
40
|
+
if p.exists():
|
|
41
|
+
diff[print](p, q)
|
|
42
|
+
else:
|
|
43
|
+
assert not q.exists()
|
|
44
|
+
p = d / 'PKG-INFO'
|
|
45
|
+
q = projectdir / p.relative_to(tempdir)
|
|
46
|
+
assert q.exists()
|
|
47
|
+
text = diff(p, q, check = False).stdout
|
|
48
|
+
sys.stdout.write(text)
|
|
49
|
+
assert all(l[0] not in '<>' or l.startswith(('> Requires-Dist: ', '> License-File: ')) for l in text.splitlines())
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'Pin requires to their minimum allowed versions.'
|
|
2
|
+
from .metacheck import egginfodir
|
|
3
|
+
from .projectinfo import ProjectInfo
|
|
4
|
+
from shutil import copy2
|
|
5
|
+
from venvpool import initlogging
|
|
6
|
+
|
|
7
|
+
def main():
|
|
8
|
+
initlogging()
|
|
9
|
+
info = ProjectInfo.seek('.')
|
|
10
|
+
with (info.projectdir / 'project.arid').open('a') as f:
|
|
11
|
+
print(f"requires = $list({' '.join(r.minstr() for r in info.parsedrequires())})", file = f)
|
|
12
|
+
with egginfodir(info.projectdir, info.devversion(), True) as (tempdir, d):
|
|
13
|
+
for name in 'PKG-INFO', 'requires.txt':
|
|
14
|
+
p = d / name
|
|
15
|
+
q = info.projectdir / p.relative_to(tempdir)
|
|
16
|
+
if p.exists():
|
|
17
|
+
copy2(p, q)
|
|
18
|
+
elif q.exists():
|
|
19
|
+
q.unlink()
|
|
20
|
+
|
|
21
|
+
if '__main__' == __name__:
|
|
22
|
+
main()
|
|
@@ -5,6 +5,7 @@ from aridity.config import ConfigCtrl
|
|
|
5
5
|
from diapyr.util import bfs
|
|
6
6
|
from lagoon import git
|
|
7
7
|
from lagoon.program import Program
|
|
8
|
+
from pathlib import Path
|
|
8
9
|
from pkg_resources import resource_filename
|
|
9
10
|
from shutil import rmtree
|
|
10
11
|
from tempfile import mkdtemp
|
|
@@ -13,16 +14,12 @@ import logging, os, sys
|
|
|
13
14
|
|
|
14
15
|
log = logging.getLogger(__name__)
|
|
15
16
|
|
|
16
|
-
def pipify(info, version
|
|
17
|
-
release = version is not None
|
|
17
|
+
def pipify(info, version):
|
|
18
18
|
# Allow release of project without origin:
|
|
19
|
-
if
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
url = f"https://pypi.org/project/{info.config.name}/"
|
|
24
|
-
else:
|
|
25
|
-
raise Exception
|
|
19
|
+
if info.config.github.participant:
|
|
20
|
+
_, url = info.descriptionandurl()
|
|
21
|
+
elif info.config.pypi.participant:
|
|
22
|
+
url = f"https://pypi.org/project/{info.config.name}/"
|
|
26
23
|
else:
|
|
27
24
|
url = None
|
|
28
25
|
cc = ConfigCtrl()
|
|
@@ -34,12 +31,14 @@ console_scripts := $list()
|
|
|
34
31
|
cc.w.tagline = info.config.tagline
|
|
35
32
|
for t in info.config.resource.types:
|
|
36
33
|
cc.w.resource.types += t
|
|
37
|
-
cc.w.version = version
|
|
34
|
+
cc.w.version = version
|
|
38
35
|
cc.w.description = info.config.tagline
|
|
39
|
-
cc.w.long_description = 'long_description()' if release else repr(None)
|
|
40
36
|
cc.w.url = url
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
if info.config.pypi.participant:
|
|
38
|
+
cc.w.author = info.config.author
|
|
39
|
+
cc.w.author_email = info.config.author_email
|
|
40
|
+
else:
|
|
41
|
+
cc.w.author = cc.w.author_email = None
|
|
43
42
|
for m in info.py_modules():
|
|
44
43
|
cc.w.py_modules += m
|
|
45
44
|
for r in info.allrequires:
|
|
@@ -61,17 +60,16 @@ console_scripts := $list()
|
|
|
61
60
|
cc.printf('" = $(%s)', quote)
|
|
62
61
|
cc.processtemplate(
|
|
63
62
|
resource_filename(__name__, template), # TODO LATER: Make aridity get the resource.
|
|
64
|
-
os.path.abspath(
|
|
63
|
+
os.path.abspath(info.projectdir / name))
|
|
65
64
|
|
|
66
65
|
def main():
|
|
67
66
|
initlogging()
|
|
68
67
|
parser = ArgumentParser()
|
|
69
68
|
parser.add_argument('--transient', action = 'store_true')
|
|
70
|
-
parser.add_argument('
|
|
71
|
-
parser.add_argument('projectdir', nargs = '?') # FIXME: When projectdir is passed in its console_scripts are not populated!
|
|
69
|
+
parser.add_argument('projectdir', nargs = '?', type = Path) # FIXME: When projectdir is passed in its console_scripts are not populated!
|
|
72
70
|
args = parser.parse_args()
|
|
73
|
-
info = ProjectInfo.seek('.') if args.projectdir is None else ProjectInfo(args.projectdir,
|
|
74
|
-
pipify(info,
|
|
71
|
+
info = ProjectInfo.seek('.') if args.projectdir is None else ProjectInfo(args.projectdir, args.projectdir / ProjectInfo.projectaridname)
|
|
72
|
+
pipify(info, info.devversion())
|
|
75
73
|
setupcommand(info, sys.version_info.major, args.transient, 'egg_info')
|
|
76
74
|
|
|
77
75
|
def setupcommand(info, pyversion, transient, *command):
|
|
@@ -118,7 +116,7 @@ class InstallDeps:
|
|
|
118
116
|
continue
|
|
119
117
|
if self.siblings:
|
|
120
118
|
siblingpath = r.siblingpath(i.contextworkspace())
|
|
121
|
-
if
|
|
119
|
+
if siblingpath.exists():
|
|
122
120
|
editableprojects[name] = j = ProjectInfo.seek(siblingpath)
|
|
123
121
|
yield j, True
|
|
124
122
|
continue
|
|
@@ -142,8 +140,8 @@ class InstallDeps:
|
|
|
142
140
|
def process(self, t):
|
|
143
141
|
return adddeps(*t)
|
|
144
142
|
for i in volatileprojects.values(): # Assume editables already pipified.
|
|
145
|
-
pipify(i)
|
|
146
|
-
self.localreqs = [i.projectdir for i in editableprojects.values()]
|
|
143
|
+
pipify(i, i.devversion())
|
|
144
|
+
self.localreqs = [str(i.projectdir) for i in editableprojects.values()]
|
|
147
145
|
self.volatileprojects = volatileprojects.values()
|
|
148
146
|
self.fetchreqs = list(Req.published(pypireqs))
|
|
149
147
|
return self
|
|
@@ -152,7 +150,7 @@ class InstallDeps:
|
|
|
152
150
|
self.fetchreqs.extend(Req.parselines(requires))
|
|
153
151
|
|
|
154
152
|
def invoke(self, venv):
|
|
155
|
-
venv.install([i.projectdir for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
153
|
+
venv.install([str(i.projectdir) for i in self.volatileprojects] + [r.reqstr for r in self.fetchreqs])
|
|
156
154
|
|
|
157
155
|
def cinvoke(self, container):
|
|
158
156
|
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])
|
|
@@ -9,7 +9,6 @@ from inspect import getsource
|
|
|
9
9
|
from lagoon import git
|
|
10
10
|
from lagoon.binary import tidy
|
|
11
11
|
from lagoon.program import Program
|
|
12
|
-
from pathlib import Path
|
|
13
12
|
from pkg_resources import parse_requirements
|
|
14
13
|
from setuphacks import getsetupkwargs
|
|
15
14
|
from urllib.error import HTTPError
|
|
@@ -77,10 +76,10 @@ class Req:
|
|
|
77
76
|
return versionstr in self.parsed
|
|
78
77
|
|
|
79
78
|
def siblingpath(self, workspace):
|
|
80
|
-
return
|
|
79
|
+
return workspace / self.namepart
|
|
81
80
|
|
|
82
81
|
def isproject(self, info):
|
|
83
|
-
return
|
|
82
|
+
return self.siblingpath(info.contextworkspace()).exists()
|
|
84
83
|
|
|
85
84
|
def minstr(self):
|
|
86
85
|
version, = (s.version for s in self.specifierset if s.operator in {'>=', '=='})
|
|
@@ -110,10 +109,10 @@ class ProjectInfo:
|
|
|
110
109
|
|
|
111
110
|
@classmethod
|
|
112
111
|
def seek(cls, realdir):
|
|
113
|
-
|
|
114
|
-
if
|
|
112
|
+
seek = Seek.seek(realdir, cls.projectaridname)
|
|
113
|
+
if seek is None:
|
|
115
114
|
raise ProjectInfoNotFoundException(realdir)
|
|
116
|
-
return cls(
|
|
115
|
+
return cls(seek.parent, seek.path)
|
|
117
116
|
|
|
118
117
|
@classmethod
|
|
119
118
|
def seekany(cls, realdir):
|
|
@@ -121,17 +120,17 @@ class ProjectInfo:
|
|
|
121
120
|
return cls.seek(realdir)
|
|
122
121
|
except ProjectInfoNotFoundException:
|
|
123
122
|
pass
|
|
124
|
-
|
|
125
|
-
if
|
|
123
|
+
setupseek = Seek.seek(realdir, 'setup.py')
|
|
124
|
+
if setupseek is not None:
|
|
126
125
|
log.info('Use setuptools mode.')
|
|
127
|
-
return _setuptoolsinfo(
|
|
126
|
+
return _setuptoolsinfo(setupseek.path)
|
|
128
127
|
log.info('Use uninstallable mode.')
|
|
129
|
-
projectdir =
|
|
128
|
+
projectdir = Seek.seek(realdir, '.git').path.parent
|
|
130
129
|
with openresource(__name__, 'setuptools.arid') as f:
|
|
131
130
|
info = cls(projectdir, f)
|
|
132
131
|
info.config.name = os.path.basename(os.path.abspath(projectdir))
|
|
133
132
|
try:
|
|
134
|
-
info.allrequires.extend((
|
|
133
|
+
info.allrequires.extend((projectdir / 'requirements.txt').read_text().splitlines())
|
|
135
134
|
except FileNotFoundError:
|
|
136
135
|
pass
|
|
137
136
|
return info
|
|
@@ -146,10 +145,10 @@ class ProjectInfo:
|
|
|
146
145
|
self.projectdir = projectdir
|
|
147
146
|
|
|
148
147
|
def mitpath(self):
|
|
149
|
-
return
|
|
148
|
+
return self.projectdir / self.config.MIT.path
|
|
150
149
|
|
|
151
150
|
def contextworkspace(self):
|
|
152
|
-
return
|
|
151
|
+
return self.projectdir / '..'
|
|
153
152
|
|
|
154
153
|
def parsedrequires(self):
|
|
155
154
|
return Req.parselines(self.allrequires)
|
|
@@ -200,8 +199,12 @@ class ProjectInfo:
|
|
|
200
199
|
return [mm.console_script for mm in self.mainmodules()]
|
|
201
200
|
|
|
202
201
|
def devversion(self):
|
|
203
|
-
releases
|
|
204
|
-
|
|
202
|
+
def releases():
|
|
203
|
+
for tag in git.tag(cwd = self.projectdir).splitlines():
|
|
204
|
+
m = re.fullmatch('release/(.+)', tag)
|
|
205
|
+
if m is not None:
|
|
206
|
+
yield int(m.group(1))
|
|
207
|
+
return f"{max(releases(), default = 0) + 1}.dev0"
|
|
205
208
|
|
|
206
209
|
class MainModule:
|
|
207
210
|
|
|
@@ -211,7 +214,7 @@ class MainModule:
|
|
|
211
214
|
|
|
212
215
|
def _setuptoolsinfo(setuppath):
|
|
213
216
|
with openresource(__name__, 'setuptools.arid') as f:
|
|
214
|
-
info = ProjectInfo(
|
|
217
|
+
info = ProjectInfo(setuppath.parent, f)
|
|
215
218
|
setupkwargs = getsetupkwargs(setuppath, ['name', 'install_requires', 'entry_points'])
|
|
216
219
|
if 'name' in setupkwargs:
|
|
217
220
|
info.config.name = setupkwargs['name']
|
|
@@ -93,11 +93,8 @@ def main():
|
|
|
93
93
|
copytree(info.projectdir, copydir)
|
|
94
94
|
for relpath in release(config, srcgit, ProjectInfo.seek(copydir)):
|
|
95
95
|
log.info("Replace artifact: %s", relpath)
|
|
96
|
-
destpath =
|
|
97
|
-
|
|
98
|
-
os.makedirs(os.path.dirname(destpath))
|
|
99
|
-
except OSError:
|
|
100
|
-
pass
|
|
96
|
+
destpath = info.projectdir / relpath
|
|
97
|
+
destpath.parent.mkdir(exist_ok = True, parents = True)
|
|
101
98
|
copy2(os.path.join(copydir, relpath), destpath)
|
|
102
99
|
|
|
103
100
|
def uploadableartifacts(artifactrelpaths):
|
|
@@ -127,11 +124,16 @@ def _runsetup(info, commands):
|
|
|
127
124
|
venv.run('check_call', ['.'], 'setup', commands, cwd = info.projectdir) # XXX: Should venvpool automatically include current dir?
|
|
128
125
|
|
|
129
126
|
def release(config, srcgit, info):
|
|
130
|
-
|
|
127
|
+
copygit = git[partial](cwd = info.projectdir)
|
|
128
|
+
scrub = copygit.clean._xdi[partial, print](input = 'c')
|
|
131
129
|
scrub()
|
|
132
130
|
version = info.nextversion()
|
|
131
|
+
releasetag = f"release/{version}"
|
|
132
|
+
if releasetag not in copygit.tag.__points_at().splitlines():
|
|
133
|
+
copygit.tag[print](releasetag)
|
|
134
|
+
copygit.push[print](config.golden_remote, releasetag)
|
|
133
135
|
pipify(info, version)
|
|
134
|
-
EveryVersion(info, False, False, [], False, True).allchecks()
|
|
136
|
+
EveryVersion(info, False, False, [], False, True).allchecks(exclude = ['metacheck'])
|
|
135
137
|
scrub()
|
|
136
138
|
for dirpath, dirnames, filenames in os.walk(info.projectdir):
|
|
137
139
|
for name in chain(filenames, dirnames):
|
|
@@ -141,7 +143,7 @@ def release(config, srcgit, info):
|
|
|
141
143
|
(os.remove if name.endswith('.py') else rmtree)(path)
|
|
142
144
|
_warmups(info)
|
|
143
145
|
pipify(info, version)
|
|
144
|
-
rmtree(
|
|
146
|
+
rmtree(info.projectdir / '.git')
|
|
145
147
|
setupcommands = []
|
|
146
148
|
if SourceInfo(info.projectdir).extpaths:
|
|
147
149
|
for image in _images():
|
|
@@ -149,11 +151,8 @@ def release(config, srcgit, info):
|
|
|
149
151
|
else:
|
|
150
152
|
setupcommands.append('bdist_wheel')
|
|
151
153
|
_runsetup(info, setupcommands + ['sdist'])
|
|
152
|
-
artifactrelpaths = [os.path.join(distrelpath, name) for name in sorted(os.listdir(
|
|
154
|
+
artifactrelpaths = [os.path.join(distrelpath, name) for name in sorted(os.listdir(info.projectdir / distrelpath))]
|
|
153
155
|
if config.upload:
|
|
154
|
-
srcgit.tag[print](f"v{version}")
|
|
155
|
-
# TODO LATER: If tag succeeded but push fails, we're left with a bogus tag.
|
|
156
|
-
srcgit.push.__tags[print]() # XXX: Also update other remotes?
|
|
157
156
|
with config.token as token:
|
|
158
157
|
Program.text(sys.executable)._m.twine.upload[print]('-u', '__token__', '-p', token, *uploadableartifacts(artifactrelpaths), cwd = info.projectdir, env = Pip.envpatch)
|
|
159
158
|
else:
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
def long_description():
|
|
4
|
-
with open('README.md') as f:
|
|
5
|
-
return f.read()
|
|
6
|
-
|
|
7
2
|
$readfile$./(sourceinfo.py)
|
|
8
3
|
sourceinfo = SourceInfo('.')
|
|
9
4
|
setup(
|
|
10
5
|
name = $"$(name),
|
|
11
6
|
version = $"$(version),
|
|
12
7
|
description = $"$(tagline),
|
|
13
|
-
long_description = $(long_description),
|
|
14
|
-
long_description_content_type = 'text/markdown',
|
|
15
8
|
url = $"$(url),
|
|
16
9
|
author = $"$(author),
|
|
17
10
|
author_email = $"$(author_email),
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from Cython.Build import cythonize
|
|
3
|
+
except ModuleNotFoundError:
|
|
4
|
+
pass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from setuptools import find_packages
|
|
7
|
+
import os
|
|
8
|
+
|
|
1
9
|
class SourceInfo:
|
|
2
10
|
|
|
3
11
|
class PYXPath:
|
|
@@ -19,8 +27,6 @@ class SourceInfo:
|
|
|
19
27
|
module = f"{moduleprefix}{name[:-len(suffix)]}"
|
|
20
28
|
if module not in extpaths:
|
|
21
29
|
extpaths[module] = self.PYXPath(module, os.path.join(dirpath, name))
|
|
22
|
-
from setuptools import find_packages
|
|
23
|
-
import os
|
|
24
30
|
self.packages = find_packages(rootdir)
|
|
25
31
|
extpaths = {}
|
|
26
32
|
addextpaths('.', '')
|
|
@@ -30,7 +36,11 @@ class SourceInfo:
|
|
|
30
36
|
|
|
31
37
|
def setup_kwargs(self):
|
|
32
38
|
kwargs = dict(packages = self.packages)
|
|
39
|
+
try:
|
|
40
|
+
kwargs['long_description'] = Path('README.md').read_text()
|
|
41
|
+
kwargs['long_description_content_type'] = 'text/markdown'
|
|
42
|
+
except FileNotFoundError:
|
|
43
|
+
pass
|
|
33
44
|
if self.extpaths:
|
|
34
|
-
from Cython.Build import cythonize
|
|
35
45
|
kwargs['ext_modules'] = cythonize([path.make_ext() for path in self.extpaths])
|
|
36
46
|
return kwargs
|
|
@@ -31,7 +31,7 @@ def main():
|
|
|
31
31
|
containerexec('apt-get', 'update')
|
|
32
32
|
containerexec('apt-get', 'install', '-y', *upstream_devel_packages)
|
|
33
33
|
containerexec('pip', 'install', req)
|
|
34
|
-
git.checkout[print](f"
|
|
34
|
+
git.checkout[print](f"release/{version}")
|
|
35
35
|
EveryVersion(ProjectInfo.seek('.'), False, False, [], True, True).nose()
|
|
36
36
|
|
|
37
37
|
if '__main__' == __name__:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from contextlib import contextmanager
|
|
2
2
|
from lagoon import docker
|
|
3
3
|
from lagoon.program import NOEOL
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
import os, re, sys
|
|
5
6
|
|
|
6
7
|
pyversiontags = {2: ['2'], 3: ['3.9', '3.10', '3.11', '3.12', '3.13']}
|
|
@@ -31,16 +32,19 @@ class Excludes:
|
|
|
31
32
|
def __contains__(self, relpath):
|
|
32
33
|
return self.pattern.search(relpath) is not None
|
|
33
34
|
|
|
34
|
-
class Seek
|
|
35
|
+
class Seek:
|
|
35
36
|
|
|
36
37
|
@classmethod
|
|
37
38
|
def seek(cls, dirpath, name):
|
|
39
|
+
dirpath = Path(dirpath)
|
|
38
40
|
while True:
|
|
39
|
-
path =
|
|
40
|
-
if
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
path = dirpath / name
|
|
42
|
+
if path.exists():
|
|
43
|
+
seek = cls()
|
|
44
|
+
seek.path = path
|
|
45
|
+
seek.parent = dirpath
|
|
46
|
+
return seek
|
|
47
|
+
parent = dirpath / '..'
|
|
44
48
|
if os.path.abspath(parent) == os.path.abspath(dirpath):
|
|
45
49
|
break
|
|
46
50
|
dirpath = parent
|
{pyven-103 → pyven-105}/setup.py
RENAMED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
try:
|
|
3
|
+
from Cython.Build import cythonize
|
|
4
|
+
except ModuleNotFoundError:
|
|
5
|
+
pass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from setuptools import find_packages
|
|
8
|
+
import os
|
|
6
9
|
|
|
7
10
|
class SourceInfo:
|
|
8
11
|
|
|
@@ -25,8 +28,6 @@ class SourceInfo:
|
|
|
25
28
|
module = f"{moduleprefix}{name[:-len(suffix)]}"
|
|
26
29
|
if module not in extpaths:
|
|
27
30
|
extpaths[module] = self.PYXPath(module, os.path.join(dirpath, name))
|
|
28
|
-
from setuptools import find_packages
|
|
29
|
-
import os
|
|
30
31
|
self.packages = find_packages(rootdir)
|
|
31
32
|
extpaths = {}
|
|
32
33
|
addextpaths('.', '')
|
|
@@ -36,18 +37,20 @@ class SourceInfo:
|
|
|
36
37
|
|
|
37
38
|
def setup_kwargs(self):
|
|
38
39
|
kwargs = dict(packages = self.packages)
|
|
40
|
+
try:
|
|
41
|
+
kwargs['long_description'] = Path('README.md').read_text()
|
|
42
|
+
kwargs['long_description_content_type'] = 'text/markdown'
|
|
43
|
+
except FileNotFoundError:
|
|
44
|
+
pass
|
|
39
45
|
if self.extpaths:
|
|
40
|
-
from Cython.Build import cythonize
|
|
41
46
|
kwargs['ext_modules'] = cythonize([path.make_ext() for path in self.extpaths])
|
|
42
47
|
return kwargs
|
|
43
48
|
|
|
44
49
|
sourceinfo = SourceInfo('.')
|
|
45
50
|
setup(
|
|
46
51
|
name = 'pyven',
|
|
47
|
-
version = '
|
|
52
|
+
version = '105',
|
|
48
53
|
description = 'Manage development of multiple Python projects',
|
|
49
|
-
long_description = long_description(),
|
|
50
|
-
long_description_content_type = 'text/markdown',
|
|
51
54
|
url = 'https://pypi.org/project/pyven/',
|
|
52
55
|
author = 'Homsar',
|
|
53
56
|
author_email = 'homsar@foyono.com',
|
pyven-103/pyven/minreqs.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'Pin requires to their minimum allowed versions.'
|
|
2
|
-
from .projectinfo import ProjectInfo
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from venvpool import initlogging
|
|
5
|
-
|
|
6
|
-
def main():
|
|
7
|
-
initlogging()
|
|
8
|
-
info = ProjectInfo.seek('.')
|
|
9
|
-
minreqs = [r.minstr() for r in info.parsedrequires()]
|
|
10
|
-
with Path(info.projectdir, 'project.arid').open('a') as f:
|
|
11
|
-
print(f"requires = $list({' '.join(minreqs)})", file = f)
|
|
12
|
-
Path(info.projectdir, 'requirements.txt').write_text(''.join(f"{r}\n" for r in minreqs) if minreqs else '# This file blank.\n')
|
|
13
|
-
|
|
14
|
-
if '__main__' == __name__:
|
|
15
|
-
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
|