pyven 94__tar.gz → 96__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-94 → pyven-96}/PKG-INFO +9 -27
- {pyven-94 → pyven-96}/README.md +0 -21
- {pyven-94 → pyven-96}/pyven/README.md.aridt +7 -3
- {pyven-94 → pyven-96}/pyven/checks.py +60 -4
- {pyven-94 → pyven-96}/pyven/divcheck.py +3 -1
- {pyven-94 → pyven-96}/pyven/mainmodules.py +1 -0
- {pyven-94 → pyven-96}/pyven/projectinfo.arid +4 -0
- {pyven-94 → pyven-96}/pyven.egg-info/PKG-INFO +9 -27
- {pyven-94 → pyven-96}/pyven.egg-info/SOURCES.txt +0 -1
- {pyven-94 → pyven-96}/pyven.egg-info/entry_points.txt +0 -2
- {pyven-94 → pyven-96}/pyven.egg-info/requires.txt +2 -1
- {pyven-94 → pyven-96}/setup.py +4 -4
- pyven-94/pyven/gclean.py +0 -100
- {pyven-94 → pyven-96}/pyven/__init__.py +0 -0
- {pyven-94 → pyven-96}/pyven/bdist.py +0 -0
- {pyven-94 → pyven-96}/pyven/cythonize.py +0 -0
- {pyven-94 → pyven-96}/pyven/drmake.py +0 -0
- {pyven-94 → pyven-96}/pyven/execcheck.py +0 -0
- {pyven-94 → pyven-96}/pyven/files.py +0 -0
- {pyven-94 → pyven-96}/pyven/functions.py +0 -0
- {pyven-94 → pyven-96}/pyven/launch.py +0 -0
- {pyven-94 → pyven-96}/pyven/licheck.py +0 -0
- {pyven-94 → pyven-96}/pyven/minreqs.py +0 -0
- {pyven-94 → pyven-96}/pyven/nlcheck.py +0 -0
- {pyven-94 → pyven-96}/pyven/patchpolicy.py +0 -0
- {pyven-94 → pyven-96}/pyven/pipify.py +0 -0
- {pyven-94 → pyven-96}/pyven/projectinfo.py +0 -0
- {pyven-94 → pyven-96}/pyven/pyproject.toml.aridt +0 -0
- {pyven-94 → pyven-96}/pyven/release.arid +0 -0
- {pyven-94 → pyven-96}/pyven/release.py +0 -0
- {pyven-94 → pyven-96}/pyven/setup-native.py.aridt +0 -0
- {pyven-94 → pyven-96}/pyven/setup.cfg.aridt +0 -0
- {pyven-94 → pyven-96}/pyven/setup.py.aridt +0 -0
- {pyven-94 → pyven-96}/pyven/setuptools.arid +0 -0
- {pyven-94 → pyven-96}/pyven/sourceinfo.py +0 -0
- {pyven-94 → pyven-96}/pyven/tasks.py +0 -0
- {pyven-94 → pyven-96}/pyven/tests/__init__.py +0 -0
- {pyven-94 → pyven-96}/pyven/tryinstall.py +0 -0
- {pyven-94 → pyven-96}/pyven/util.py +0 -0
- {pyven-94 → pyven-96}/pyven.egg-info/dependency_links.txt +0 -0
- {pyven-94 → pyven-96}/pyven.egg-info/top_level.txt +0 -0
- {pyven-94 → pyven-96}/setup.cfg +0 -0
{pyven-94 → pyven-96}/PKG-INFO
RENAMED
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 96
|
|
4
4
|
Summary: Manage development of multiple Python projects
|
|
5
5
|
Home-page: https://pypi.org/project/pyven/
|
|
6
|
-
Author:
|
|
6
|
+
Author: Homsar
|
|
7
7
|
Author-email: shrovis@foyono.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: aridity>=67
|
|
10
|
+
Requires-Dist: diapyr>=27
|
|
11
|
+
Requires-Dist: lagoon>=24
|
|
12
|
+
Requires-Dist: pydoc-markdown>=3.3
|
|
13
|
+
Requires-Dist: setuptools>=44.1.1
|
|
14
|
+
Requires-Dist: twine>=1.15.0
|
|
15
|
+
Requires-Dist: venvpool>=14
|
|
11
16
|
|
|
12
17
|
# pyven
|
|
13
18
|
Manage development of multiple Python projects
|
|
14
19
|
|
|
15
|
-
## Install
|
|
16
|
-
These are generic installation instructions.
|
|
17
|
-
|
|
18
|
-
### To use, permanently
|
|
19
|
-
The quickest way to get started is to install the current release from PyPI:
|
|
20
|
-
```
|
|
21
|
-
pip3 install --user pyven
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### To use, temporarily
|
|
25
|
-
If you prefer to keep .local clean, install to a virtualenv:
|
|
26
|
-
```
|
|
27
|
-
python3 -m venv venvname
|
|
28
|
-
venvname/bin/pip install -U pip
|
|
29
|
-
venvname/bin/pip install pyven
|
|
30
|
-
. venvname/bin/activate
|
|
31
|
-
```
|
|
32
|
-
|
|
33
20
|
## Commands
|
|
34
21
|
|
|
35
22
|
### drmake
|
|
36
23
|
Build a Docker image with automatic tag.
|
|
37
24
|
|
|
38
|
-
### gclean
|
|
39
|
-
Remove files matching patterns below #glean in .gitignore file.
|
|
40
|
-
|
|
41
25
|
### launch
|
|
42
26
|
Run project using a suitable venv from the pool.
|
|
43
27
|
|
|
@@ -58,5 +42,3 @@ Run project unit tests and more, also suitable for CI.
|
|
|
58
42
|
|
|
59
43
|
### tryinstall
|
|
60
44
|
Check last release can be installed from PyPI and its tests still pass, for use by CI.
|
|
61
|
-
|
|
62
|
-
|
{pyven-94 → pyven-96}/README.md
RENAMED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
# pyven
|
|
2
2
|
Manage development of multiple Python projects
|
|
3
3
|
|
|
4
|
-
## Install
|
|
5
|
-
These are generic installation instructions.
|
|
6
|
-
|
|
7
|
-
### To use, permanently
|
|
8
|
-
The quickest way to get started is to install the current release from PyPI:
|
|
9
|
-
```
|
|
10
|
-
pip3 install --user pyven
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### To use, temporarily
|
|
14
|
-
If you prefer to keep .local clean, install to a virtualenv:
|
|
15
|
-
```
|
|
16
|
-
python3 -m venv venvname
|
|
17
|
-
venvname/bin/pip install -U pip
|
|
18
|
-
venvname/bin/pip install pyven
|
|
19
|
-
. venvname/bin/activate
|
|
20
|
-
```
|
|
21
|
-
|
|
22
4
|
## Commands
|
|
23
5
|
|
|
24
6
|
### drmake
|
|
25
7
|
Build a Docker image with automatic tag.
|
|
26
8
|
|
|
27
|
-
### gclean
|
|
28
|
-
Remove files matching patterns below #glean in .gitignore file.
|
|
29
|
-
|
|
30
9
|
### launch
|
|
31
10
|
Run project using a suitable venv from the pool.
|
|
32
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# $(name)
|
|
2
|
-
$(tagline)
|
|
2
|
+
$(tagline)$try($.($(verbose_blank)
|
|
3
3
|
|
|
4
4
|
## Install
|
|
5
5
|
These are generic installation instructions.
|
|
@@ -17,9 +17,13 @@ python$first$(pyversions) -m venv venvname
|
|
|
17
17
|
venvname/bin/pip install -U pip
|
|
18
18
|
venvname/bin/pip install $(name)
|
|
19
19
|
. venvname/bin/activate
|
|
20
|
-
|
|
20
|
+
```) $.())$try($join$list$first$map($(commands) $.[
|
|
21
21
|
|
|
22
22
|
## Commands]) $.())$join$map($(commands) $.[
|
|
23
23
|
|
|
24
24
|
### $(name)
|
|
25
|
-
$(doc)])
|
|
25
|
+
$(doc)])$try($.(
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
$rmeol$(pydoc)) $.())
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
from .divcheck import commentregex
|
|
1
2
|
from .files import Files
|
|
2
3
|
from .pipify import InstallDeps
|
|
3
4
|
from .projectinfo import ProjectInfo, SimpleInstallDeps
|
|
4
5
|
from .util import bgcontainer, Excludes, initapt, pyversiontags, stderr
|
|
5
6
|
from argparse import ArgumentParser
|
|
6
7
|
from aridity.config import ConfigCtrl
|
|
8
|
+
from aridity.model import Text
|
|
7
9
|
from aridity.util import NoSuchPathException, openresource
|
|
8
10
|
from diapyr.util import singleton
|
|
9
11
|
from itertools import chain
|
|
10
12
|
from lagoon import diff
|
|
11
13
|
from lagoon.program import partial
|
|
12
14
|
from setuptools import find_packages
|
|
15
|
+
from shutil import copytree, ignore_patterns
|
|
13
16
|
from tempfile import NamedTemporaryFile
|
|
14
|
-
from venvpool import initlogging, Pool
|
|
15
|
-
import logging, os, shutil, subprocess, sys
|
|
17
|
+
from venvpool import dotpy, initlogging, Pool, Task, TemporaryDirectory
|
|
18
|
+
import logging, os, re, shutil, subprocess, sys
|
|
16
19
|
|
|
17
20
|
log = logging.getLogger(__name__)
|
|
18
21
|
skip = object()
|
|
@@ -47,7 +50,7 @@ class EveryVersion:
|
|
|
47
50
|
self.transient = transient
|
|
48
51
|
|
|
49
52
|
def allchecks(self):
|
|
50
|
-
for check in self.licheck, self.nlcheck, self.execcheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github:
|
|
53
|
+
for check in self.licheck, self.nlcheck, self.execcheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
|
|
51
54
|
check()
|
|
52
55
|
|
|
53
56
|
def licheck(self):
|
|
@@ -114,7 +117,12 @@ class EveryVersion:
|
|
|
114
117
|
else:
|
|
115
118
|
coveragepath = '.coverage'
|
|
116
119
|
with Pool(pyversion).readonlyortransient[self.transient](installdeps) as venv:
|
|
117
|
-
status = venv.run('call', installdeps.localreqs, '
|
|
120
|
+
status = venv.run('call', installdeps.localreqs, Task('''import collections
|
|
121
|
+
try:
|
|
122
|
+
collections.Callable
|
|
123
|
+
except AttributeError:
|
|
124
|
+
from collections.abc import Callable
|
|
125
|
+
collections.Callable = Callable''', 'nose'), [
|
|
118
126
|
'--exe', '-v',
|
|
119
127
|
'--with-xunit', '--xunit-file', xmlpath,
|
|
120
128
|
'--with-cov', '--cov-report', 'term-missing',
|
|
@@ -129,11 +137,46 @@ class EveryVersion:
|
|
|
129
137
|
for _, o in resolvable.resolve(scope).resolveditems():
|
|
130
138
|
return o
|
|
131
139
|
raise NoSuchPathException('Empty set.')
|
|
140
|
+
def rmeol(scope, resolvable):
|
|
141
|
+
text = resolvable.resolve(scope).cat()
|
|
142
|
+
if text.endswith('\r\n'):
|
|
143
|
+
n = 2
|
|
144
|
+
elif text.endswith(('\r', '\n')):
|
|
145
|
+
n = 1
|
|
146
|
+
else:
|
|
147
|
+
raise NoSuchPathException('No line terminator to remove.')
|
|
148
|
+
return Text(text[:-n])
|
|
149
|
+
def getpydoc(mainmodules):
|
|
150
|
+
from lagoon import pydoc_markdown
|
|
151
|
+
with TemporaryDirectory() as pydocparent:
|
|
152
|
+
pydocdir = os.path.join(pydocparent, 'project')
|
|
153
|
+
copytree(self.info.projectdir, pydocdir, ignore = ignore_patterns('test_*'))
|
|
154
|
+
internal = {(os.path.dirname(mm.relpath) if '__init__.py' == os.path.basename(mm.relpath) else mm.relpath[:-len(dotpy)]).replace(os.sep, '.') for mm in mainmodules}
|
|
155
|
+
internal.update(self.info.config.internal_module)
|
|
156
|
+
modules = []
|
|
157
|
+
for dirpath, dirnames, filenames in os.walk(pydocdir):
|
|
158
|
+
for name in filenames:
|
|
159
|
+
if name.endswith(dotpy):
|
|
160
|
+
pypath = os.path.join(dirpath, name)
|
|
161
|
+
with open(pypath, 'r+') as f:
|
|
162
|
+
text = f.read()
|
|
163
|
+
cleantext = re.sub(commentregex, '', text, flags = re.MULTILINE)
|
|
164
|
+
if cleantext != text:
|
|
165
|
+
f.seek(0)
|
|
166
|
+
f.write(cleantext)
|
|
167
|
+
f.truncate()
|
|
168
|
+
modules.append(os.path.relpath(dirpath if '__init__.py' == name else pypath[:-len(dotpy)], pydocdir).replace(os.sep, '.'))
|
|
169
|
+
acc = re.sub('^#', '###', pydoc_markdown('--search-path', pydocdir), flags = re.MULTILINE)
|
|
170
|
+
acc = re.split('(?=^<a id="(?:%s)")' % '|'.join(map(re.escape, modules)), acc, flags = re.MULTILINE) # Module names are markup attribute-safe.
|
|
171
|
+
return ''.join(sorted(block for block in acc if block and re.search('"([^"]+)', block).group(1) not in internal))
|
|
132
172
|
def readme():
|
|
133
173
|
if not (self.info.config.github.participant or self.info.config.pypi.participant):
|
|
134
174
|
return skip
|
|
135
175
|
config = (-self.info.config).childctrl().node
|
|
136
176
|
config.first = first
|
|
177
|
+
config.rmeol = rmeol
|
|
178
|
+
if self.info.config.readme_verbose:
|
|
179
|
+
config.verbose_blank = ''
|
|
137
180
|
(-config).execute('commands * name = $label()')
|
|
138
181
|
mainmodules = sorted(self.info.mainmodules(), key = lambda mm: mm.command)
|
|
139
182
|
undocumented = [mm.command for mm in mainmodules if mm.doc is None]
|
|
@@ -141,6 +184,8 @@ class EveryVersion:
|
|
|
141
184
|
raise Exception("Undocumented: %s" % undocumented)
|
|
142
185
|
for mm in mainmodules:
|
|
143
186
|
(-config).printf("commands %s doc = %s", mm.command, mm.doc)
|
|
187
|
+
if self.info.config.pydoc_enabled:
|
|
188
|
+
config.pydoc = getpydoc(mainmodules)
|
|
144
189
|
with NamedTemporaryFile('w') as g:
|
|
145
190
|
with openresource(__name__, 'README.md.aridt') as f:
|
|
146
191
|
(-config).processtemplate(f, g)
|
|
@@ -159,6 +204,17 @@ class EveryVersion:
|
|
|
159
204
|
assert self.info.config.tagline == description
|
|
160
205
|
_runcheck('*', github)
|
|
161
206
|
|
|
207
|
+
def linktree(self):
|
|
208
|
+
def linktree():
|
|
209
|
+
account = self.info.config.linktree.account
|
|
210
|
+
if account is None:
|
|
211
|
+
return skip
|
|
212
|
+
from urllib.request import urlopen
|
|
213
|
+
from xml.sax.saxutils import escape
|
|
214
|
+
with urlopen("https://linktr.ee/%s" % account) as f: # TODO: Percent-encode.
|
|
215
|
+
assert ">%s \N{BULLET} %s<" % tuple(map(escape, [self.info.config.name, self.info.config.tagline])) in f.read().decode('utf-8') # TODO: Deduce encoding, consider lagoon URL.
|
|
216
|
+
_runcheck('*', linktree)
|
|
217
|
+
|
|
162
218
|
class Container:
|
|
163
219
|
|
|
164
220
|
workdir = '/io'
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import ast, re, sys
|
|
2
2
|
|
|
3
|
+
commentregex = ' \N{NUMBER SIGN} .+'
|
|
4
|
+
|
|
3
5
|
def main():
|
|
4
6
|
for path in sys.argv[1:]:
|
|
5
7
|
with open(path) as f:
|
|
@@ -10,7 +12,7 @@ def main():
|
|
|
10
12
|
break
|
|
11
13
|
else:
|
|
12
14
|
hasdiv = False
|
|
13
|
-
if hasdiv == (re.search(
|
|
15
|
+
if hasdiv == (re.search("^from __future__ import division(?:%s)?$" % commentregex, text, flags = re.MULTILINE) is None):
|
|
14
16
|
raise Exception(path)
|
|
15
17
|
|
|
16
18
|
if ('__main__' == __name__):
|
|
@@ -17,6 +17,7 @@ pypi
|
|
|
17
17
|
github
|
|
18
18
|
account = $(None)
|
|
19
19
|
participant = $neq($(account) $(None))
|
|
20
|
+
linktree account = $(None)
|
|
20
21
|
devel
|
|
21
22
|
packages := $list()
|
|
22
23
|
scripts := $list()
|
|
@@ -25,3 +26,6 @@ upstream devel packages := $list()
|
|
|
25
26
|
test requires := $list()
|
|
26
27
|
tagline = $(void)
|
|
27
28
|
native = false
|
|
29
|
+
pydoc_enabled = true
|
|
30
|
+
readme_verbose = $(github participant)
|
|
31
|
+
internal_module := $list()
|
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 96
|
|
4
4
|
Summary: Manage development of multiple Python projects
|
|
5
5
|
Home-page: https://pypi.org/project/pyven/
|
|
6
|
-
Author:
|
|
6
|
+
Author: Homsar
|
|
7
7
|
Author-email: shrovis@foyono.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: aridity>=67
|
|
10
|
+
Requires-Dist: diapyr>=27
|
|
11
|
+
Requires-Dist: lagoon>=24
|
|
12
|
+
Requires-Dist: pydoc-markdown>=3.3
|
|
13
|
+
Requires-Dist: setuptools>=44.1.1
|
|
14
|
+
Requires-Dist: twine>=1.15.0
|
|
15
|
+
Requires-Dist: venvpool>=14
|
|
11
16
|
|
|
12
17
|
# pyven
|
|
13
18
|
Manage development of multiple Python projects
|
|
14
19
|
|
|
15
|
-
## Install
|
|
16
|
-
These are generic installation instructions.
|
|
17
|
-
|
|
18
|
-
### To use, permanently
|
|
19
|
-
The quickest way to get started is to install the current release from PyPI:
|
|
20
|
-
```
|
|
21
|
-
pip3 install --user pyven
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### To use, temporarily
|
|
25
|
-
If you prefer to keep .local clean, install to a virtualenv:
|
|
26
|
-
```
|
|
27
|
-
python3 -m venv venvname
|
|
28
|
-
venvname/bin/pip install -U pip
|
|
29
|
-
venvname/bin/pip install pyven
|
|
30
|
-
. venvname/bin/activate
|
|
31
|
-
```
|
|
32
|
-
|
|
33
20
|
## Commands
|
|
34
21
|
|
|
35
22
|
### drmake
|
|
36
23
|
Build a Docker image with automatic tag.
|
|
37
24
|
|
|
38
|
-
### gclean
|
|
39
|
-
Remove files matching patterns below #glean in .gitignore file.
|
|
40
|
-
|
|
41
25
|
### launch
|
|
42
26
|
Run project using a suitable venv from the pool.
|
|
43
27
|
|
|
@@ -58,5 +42,3 @@ Run project unit tests and more, also suitable for CI.
|
|
|
58
42
|
|
|
59
43
|
### tryinstall
|
|
60
44
|
Check last release can be installed from PyPI and its tests still pass, for use by CI.
|
|
61
|
-
|
|
62
|
-
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
[console_scripts]
|
|
2
2
|
drmake = pyven.drmake:main
|
|
3
|
-
gclean = pyven.gclean:main
|
|
4
3
|
launch = pyven.launch:main
|
|
5
4
|
minreqs = pyven.minreqs:main
|
|
6
5
|
pipify = pyven.pipify:main
|
|
@@ -8,4 +7,3 @@ release = pyven.release:main
|
|
|
8
7
|
tasks = pyven.tasks:main
|
|
9
8
|
tests = pyven.tests.__init__:main
|
|
10
9
|
tryinstall = pyven.tryinstall:main
|
|
11
|
-
|
{pyven-94 → pyven-96}/setup.py
RENAMED
|
@@ -6,16 +6,16 @@ def long_description():
|
|
|
6
6
|
|
|
7
7
|
setup(
|
|
8
8
|
name = 'pyven',
|
|
9
|
-
version = '
|
|
9
|
+
version = '96',
|
|
10
10
|
description = 'Manage development of multiple Python projects',
|
|
11
11
|
long_description = long_description(),
|
|
12
12
|
long_description_content_type = 'text/markdown',
|
|
13
13
|
url = 'https://pypi.org/project/pyven/',
|
|
14
|
-
author = '
|
|
14
|
+
author = 'Homsar',
|
|
15
15
|
author_email = 'shrovis@foyono.com',
|
|
16
16
|
packages = find_packages(),
|
|
17
17
|
py_modules = [],
|
|
18
|
-
install_requires = ['aridity>=67', 'diapyr>=27', 'lagoon>=24', 'setuptools>=44.1.1', 'twine>=1.15.0', 'venvpool>=
|
|
18
|
+
install_requires = ['aridity>=67', 'diapyr>=27', 'lagoon>=24', 'pydoc-markdown>=3.3', 'setuptools>=44.1.1', 'twine>=1.15.0', 'venvpool>=14'],
|
|
19
19
|
package_data = {'': ['*.pxd', '*.pyx', '*.pyxbld', '*.arid', '*.aridt']},
|
|
20
|
-
entry_points = {'console_scripts': ['drmake=pyven.drmake:main', '
|
|
20
|
+
entry_points = {'console_scripts': ['drmake=pyven.drmake:main', 'launch=pyven.launch:main', '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']},
|
|
21
21
|
)
|
pyven-94/pyven/gclean.py
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
'Remove files matching patterns below #glean in .gitignore file.'
|
|
2
|
-
from .util import stderr
|
|
3
|
-
import re, os, sys, shutil
|
|
4
|
-
|
|
5
|
-
def removedir(path):
|
|
6
|
-
if os.path.islink(path):
|
|
7
|
-
os.remove(path)
|
|
8
|
-
else:
|
|
9
|
-
shutil.rmtree(path)
|
|
10
|
-
|
|
11
|
-
class Pattern:
|
|
12
|
-
|
|
13
|
-
def __init__(self, regex, dironly):
|
|
14
|
-
self.regex = re.compile(regex)
|
|
15
|
-
self.dironly = dironly
|
|
16
|
-
|
|
17
|
-
def accept(self, path, isdir):
|
|
18
|
-
if self.dironly and not isdir:
|
|
19
|
-
return False
|
|
20
|
-
return self.regex.search(path) is not None
|
|
21
|
-
|
|
22
|
-
def __repr__(self):
|
|
23
|
-
return "%s(%r, %r)" % (self.__class__.__name__, self.regex.pattern, self.dironly)
|
|
24
|
-
|
|
25
|
-
class HgStyle:
|
|
26
|
-
|
|
27
|
-
name = '.hgignore'
|
|
28
|
-
|
|
29
|
-
def pattern(self, line):
|
|
30
|
-
return Pattern(line, False)
|
|
31
|
-
|
|
32
|
-
class GitStyle:
|
|
33
|
-
|
|
34
|
-
name = '.gitignore'
|
|
35
|
-
|
|
36
|
-
def pattern(self, line):
|
|
37
|
-
if line.startswith('/'):
|
|
38
|
-
anchor = '^'
|
|
39
|
-
line = line[1:]
|
|
40
|
-
else:
|
|
41
|
-
anchor = '(?:^|/)'
|
|
42
|
-
if line.endswith('/'):
|
|
43
|
-
dironly = True
|
|
44
|
-
line = line[:-1]
|
|
45
|
-
else:
|
|
46
|
-
dironly = False
|
|
47
|
-
def repl(m):
|
|
48
|
-
text = m.group()
|
|
49
|
-
if '*' not in text:
|
|
50
|
-
return re.escape(text)
|
|
51
|
-
elif '*' == text:
|
|
52
|
-
return '[^/]*'
|
|
53
|
-
else:
|
|
54
|
-
raise Exception("Unsupported glob: " % text)
|
|
55
|
-
return Pattern("%s%s$" % (anchor, re.sub('[*]+|[^*]+', repl, line)), dironly)
|
|
56
|
-
|
|
57
|
-
def styleornone():
|
|
58
|
-
for style in HgStyle, GitStyle:
|
|
59
|
-
if os.path.exists(style.name):
|
|
60
|
-
return style()
|
|
61
|
-
|
|
62
|
-
def main():
|
|
63
|
-
roots = sys.argv[1:]
|
|
64
|
-
while True:
|
|
65
|
-
style = styleornone()
|
|
66
|
-
if style is not None:
|
|
67
|
-
stderr(style)
|
|
68
|
-
break
|
|
69
|
-
oldpwd = os.getcwd()
|
|
70
|
-
os.chdir('..')
|
|
71
|
-
if oldpwd == os.getcwd():
|
|
72
|
-
raise Exception('No style found.')
|
|
73
|
-
roots = [os.path.join(os.path.basename(oldpwd), root) for root in roots]
|
|
74
|
-
patterns = []
|
|
75
|
-
with open(style.name) as f:
|
|
76
|
-
armed = False
|
|
77
|
-
for line in f:
|
|
78
|
-
line, = line.splitlines()
|
|
79
|
-
if armed:
|
|
80
|
-
patterns.append(style.pattern(line))
|
|
81
|
-
stderr(patterns[-1])
|
|
82
|
-
else:
|
|
83
|
-
armed = '#gclean' == line
|
|
84
|
-
def tryremovepath(path, isdir):
|
|
85
|
-
path = os.path.normpath(path)
|
|
86
|
-
for pattern in patterns:
|
|
87
|
-
if pattern.accept(path, isdir):
|
|
88
|
-
stderr(path)
|
|
89
|
-
(removedir if isdir else os.remove)(path)
|
|
90
|
-
break
|
|
91
|
-
for root in (roots if roots else ['.']):
|
|
92
|
-
for dirpath, dirnames, filenames in os.walk(root):
|
|
93
|
-
dirnames.sort()
|
|
94
|
-
for name in dirnames:
|
|
95
|
-
tryremovepath(os.path.join(dirpath, name), True)
|
|
96
|
-
for name in sorted(filenames):
|
|
97
|
-
tryremovepath(os.path.join(dirpath, name), False)
|
|
98
|
-
|
|
99
|
-
if '__main__' == __name__:
|
|
100
|
-
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
|
|
File without changes
|
|
File without changes
|
{pyven-94 → pyven-96}/setup.cfg
RENAMED
|
File without changes
|