pyven 95__tar.gz → 97__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-95 → pyven-97}/PKG-INFO +8 -26
- {pyven-95 → pyven-97}/README.md +0 -21
- {pyven-95 → pyven-97}/pyven/README.md.aridt +8 -3
- {pyven-95 → pyven-97}/pyven/checks.py +43 -3
- {pyven-95 → pyven-97}/pyven/divcheck.py +3 -1
- {pyven-95 → pyven-97}/pyven/mainmodules.py +1 -0
- {pyven-95 → pyven-97}/pyven/projectinfo.arid +4 -0
- {pyven-95 → pyven-97}/pyven/projectinfo.py +3 -3
- {pyven-95 → pyven-97}/pyven/tasks.py +1 -1
- {pyven-95 → pyven-97}/pyven.egg-info/PKG-INFO +8 -26
- {pyven-95 → pyven-97}/pyven.egg-info/SOURCES.txt +0 -1
- {pyven-95 → pyven-97}/pyven.egg-info/entry_points.txt +0 -2
- {pyven-95 → pyven-97}/pyven.egg-info/requires.txt +2 -1
- {pyven-95 → pyven-97}/setup.py +3 -3
- pyven-95/pyven/gclean.py +0 -100
- {pyven-95 → pyven-97}/pyven/__init__.py +0 -0
- {pyven-95 → pyven-97}/pyven/bdist.py +0 -0
- {pyven-95 → pyven-97}/pyven/cythonize.py +0 -0
- {pyven-95 → pyven-97}/pyven/drmake.py +0 -0
- {pyven-95 → pyven-97}/pyven/execcheck.py +0 -0
- {pyven-95 → pyven-97}/pyven/files.py +0 -0
- {pyven-95 → pyven-97}/pyven/functions.py +0 -0
- {pyven-95 → pyven-97}/pyven/launch.py +0 -0
- {pyven-95 → pyven-97}/pyven/licheck.py +0 -0
- {pyven-95 → pyven-97}/pyven/minreqs.py +0 -0
- {pyven-95 → pyven-97}/pyven/nlcheck.py +0 -0
- {pyven-95 → pyven-97}/pyven/patchpolicy.py +0 -0
- {pyven-95 → pyven-97}/pyven/pipify.py +0 -0
- {pyven-95 → pyven-97}/pyven/pyproject.toml.aridt +0 -0
- {pyven-95 → pyven-97}/pyven/release.arid +0 -0
- {pyven-95 → pyven-97}/pyven/release.py +0 -0
- {pyven-95 → pyven-97}/pyven/setup-native.py.aridt +0 -0
- {pyven-95 → pyven-97}/pyven/setup.cfg.aridt +0 -0
- {pyven-95 → pyven-97}/pyven/setup.py.aridt +0 -0
- {pyven-95 → pyven-97}/pyven/setuptools.arid +0 -0
- {pyven-95 → pyven-97}/pyven/sourceinfo.py +0 -0
- {pyven-95 → pyven-97}/pyven/tests/__init__.py +0 -0
- {pyven-95 → pyven-97}/pyven/tryinstall.py +0 -0
- {pyven-95 → pyven-97}/pyven/util.py +0 -0
- {pyven-95 → pyven-97}/pyven.egg-info/dependency_links.txt +0 -0
- {pyven-95 → pyven-97}/pyven.egg-info/top_level.txt +0 -0
- {pyven-95 → pyven-97}/setup.cfg +0 -0
{pyven-95 → pyven-97}/PKG-INFO
RENAMED
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 97
|
|
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: shrovis@foyono.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: aridity>=77
|
|
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-95 → pyven-97}/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,14 @@ 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
|
+
$(pydoc)$hole$.(
|
|
30
|
+
)) $.())
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from .divcheck import commentregex
|
|
1
2
|
from .files import Files
|
|
2
3
|
from .pipify import InstallDeps
|
|
3
4
|
from .projectinfo import ProjectInfo, SimpleInstallDeps
|
|
@@ -10,9 +11,10 @@ from itertools import chain
|
|
|
10
11
|
from lagoon import diff
|
|
11
12
|
from lagoon.program import partial
|
|
12
13
|
from setuptools import find_packages
|
|
14
|
+
from shutil import copytree, ignore_patterns
|
|
13
15
|
from tempfile import NamedTemporaryFile
|
|
14
|
-
from venvpool import initlogging, Pool, Task
|
|
15
|
-
import logging, os, shutil, subprocess, sys
|
|
16
|
+
from venvpool import dotpy, initlogging, Pool, Task, TemporaryDirectory
|
|
17
|
+
import logging, os, re, shutil, subprocess, sys
|
|
16
18
|
|
|
17
19
|
log = logging.getLogger(__name__)
|
|
18
20
|
skip = object()
|
|
@@ -47,7 +49,7 @@ class EveryVersion:
|
|
|
47
49
|
self.transient = transient
|
|
48
50
|
|
|
49
51
|
def allchecks(self):
|
|
50
|
-
for check in self.licheck, self.nlcheck, self.execcheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github:
|
|
52
|
+
for check in self.licheck, self.nlcheck, self.execcheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
|
|
51
53
|
check()
|
|
52
54
|
|
|
53
55
|
def licheck(self):
|
|
@@ -134,11 +136,36 @@ except AttributeError:
|
|
|
134
136
|
for _, o in resolvable.resolve(scope).resolveditems():
|
|
135
137
|
return o
|
|
136
138
|
raise NoSuchPathException('Empty set.')
|
|
139
|
+
def getpydoc(mainmodules):
|
|
140
|
+
from lagoon import pydoc_markdown
|
|
141
|
+
with TemporaryDirectory() as pydocparent:
|
|
142
|
+
pydocdir = os.path.join(pydocparent, 'project')
|
|
143
|
+
copytree(self.info.projectdir, pydocdir, ignore = ignore_patterns('test_*'))
|
|
144
|
+
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}
|
|
145
|
+
internal.update(self.info.config.internal_module)
|
|
146
|
+
modules = []
|
|
147
|
+
for dirpath, dirnames, filenames in os.walk(pydocdir):
|
|
148
|
+
for name in filenames:
|
|
149
|
+
if name.endswith(dotpy):
|
|
150
|
+
pypath = os.path.join(dirpath, name)
|
|
151
|
+
with open(pypath, 'r+') as f:
|
|
152
|
+
text = f.read()
|
|
153
|
+
cleantext = re.sub(commentregex, '', text, flags = re.MULTILINE)
|
|
154
|
+
if cleantext != text:
|
|
155
|
+
f.seek(0)
|
|
156
|
+
f.write(cleantext)
|
|
157
|
+
f.truncate()
|
|
158
|
+
modules.append(os.path.relpath(dirpath if '__init__.py' == name else pypath[:-len(dotpy)], pydocdir).replace(os.sep, '.'))
|
|
159
|
+
acc = re.sub('^#', '###', pydoc_markdown('--search-path', pydocdir), flags = re.MULTILINE)
|
|
160
|
+
acc = re.split('(?=^<a id="(?:%s)")' % '|'.join(map(re.escape, modules)), acc, flags = re.MULTILINE) # Module names are markup attribute-safe.
|
|
161
|
+
return ''.join(sorted(block for block in acc if block and re.search('"([^"]+)', block).group(1) not in internal))
|
|
137
162
|
def readme():
|
|
138
163
|
if not (self.info.config.github.participant or self.info.config.pypi.participant):
|
|
139
164
|
return skip
|
|
140
165
|
config = (-self.info.config).childctrl().node
|
|
141
166
|
config.first = first
|
|
167
|
+
if self.info.config.readme_verbose:
|
|
168
|
+
config.verbose_blank = ''
|
|
142
169
|
(-config).execute('commands * name = $label()')
|
|
143
170
|
mainmodules = sorted(self.info.mainmodules(), key = lambda mm: mm.command)
|
|
144
171
|
undocumented = [mm.command for mm in mainmodules if mm.doc is None]
|
|
@@ -146,6 +173,8 @@ except AttributeError:
|
|
|
146
173
|
raise Exception("Undocumented: %s" % undocumented)
|
|
147
174
|
for mm in mainmodules:
|
|
148
175
|
(-config).printf("commands %s doc = %s", mm.command, mm.doc)
|
|
176
|
+
if self.info.config.pydoc_enabled:
|
|
177
|
+
config.pydoc = getpydoc(mainmodules)
|
|
149
178
|
with NamedTemporaryFile('w') as g:
|
|
150
179
|
with openresource(__name__, 'README.md.aridt') as f:
|
|
151
180
|
(-config).processtemplate(f, g)
|
|
@@ -164,6 +193,17 @@ except AttributeError:
|
|
|
164
193
|
assert self.info.config.tagline == description
|
|
165
194
|
_runcheck('*', github)
|
|
166
195
|
|
|
196
|
+
def linktree(self):
|
|
197
|
+
def linktree():
|
|
198
|
+
account = self.info.config.linktree.account
|
|
199
|
+
if account is None:
|
|
200
|
+
return skip
|
|
201
|
+
from urllib.request import urlopen
|
|
202
|
+
from xml.sax.saxutils import escape
|
|
203
|
+
with urlopen("https://linktr.ee/%s" % account) as f: # TODO: Percent-encode.
|
|
204
|
+
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.
|
|
205
|
+
_runcheck('*', linktree)
|
|
206
|
+
|
|
167
207
|
class Container:
|
|
168
208
|
|
|
169
209
|
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()
|
|
@@ -6,7 +6,6 @@ from aridity.model import Entry, Resource
|
|
|
6
6
|
from aridity.util import openresource
|
|
7
7
|
from inspect import getsource
|
|
8
8
|
from pkg_resources import parse_requirements
|
|
9
|
-
from pkg_resources.extern.packaging.markers import UndefinedEnvironmentName
|
|
10
9
|
from setuphacks import getsetupkwargs
|
|
11
10
|
from venvpool import ParsedRequires, TemporaryDirectory
|
|
12
11
|
import logging, os, re, subprocess, venvpool
|
|
@@ -89,8 +88,9 @@ class Req:
|
|
|
89
88
|
if marker is None or marker.evaluate():
|
|
90
89
|
assert not self.parsed.extras # Not supported.
|
|
91
90
|
return True
|
|
92
|
-
except
|
|
93
|
-
|
|
91
|
+
except ValueError as e:
|
|
92
|
+
if 'UndefinedEnvironmentName' != type(e).__name__:
|
|
93
|
+
raise
|
|
94
94
|
|
|
95
95
|
def keyversion(self):
|
|
96
96
|
s, = self.specifierset
|
|
@@ -10,7 +10,7 @@ def main():
|
|
|
10
10
|
root, = subprocess.check_output(['git', 'rev-parse', '--show-toplevel']).decode().splitlines()
|
|
11
11
|
agcommand = ['ag', '--noheading', '--nobreak']
|
|
12
12
|
# XXX: Integrate with declared project resource types?
|
|
13
|
-
paths = list(Files.relpaths(root, ['.py', '.pyx', '.h', '.cpp', '.ui', '.java', '.kt', '.c', '.s', '.sh', '.arid', '.aridt', '.gradle', '.java', '.mk'], ['Dockerfile', 'Makefile']))
|
|
13
|
+
paths = list(Files.relpaths(root, ['.py', '.pyx', '.h', '.cpp', '.ui', '.java', '.kt', '.c', '.s', '.sh', '.arid', '.aridt', '.gradle', '.java', '.mk', '.js'], ['Dockerfile', 'Makefile']))
|
|
14
14
|
for tag in ['XX''X', 'TO''DO', 'FIX''ME'][config.q:]:
|
|
15
15
|
subprocess.call(agcommand + [tag + ' LATER'] + paths, cwd = root)
|
|
16
16
|
subprocess.call(agcommand + [tag + '(?! LATER)'] + paths, cwd = root)
|
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyven
|
|
3
|
-
Version:
|
|
3
|
+
Version: 97
|
|
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: shrovis@foyono.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: aridity>=77
|
|
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-95 → pyven-97}/setup.py
RENAMED
|
@@ -6,7 +6,7 @@ def long_description():
|
|
|
6
6
|
|
|
7
7
|
setup(
|
|
8
8
|
name = 'pyven',
|
|
9
|
-
version = '
|
|
9
|
+
version = '97',
|
|
10
10
|
description = 'Manage development of multiple Python projects',
|
|
11
11
|
long_description = long_description(),
|
|
12
12
|
long_description_content_type = 'text/markdown',
|
|
@@ -15,7 +15,7 @@ setup(
|
|
|
15
15
|
author_email = 'shrovis@foyono.com',
|
|
16
16
|
packages = find_packages(),
|
|
17
17
|
py_modules = [],
|
|
18
|
-
install_requires = ['aridity>=
|
|
18
|
+
install_requires = ['aridity>=77', '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-95/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
|
{pyven-95 → pyven-97}/setup.cfg
RENAMED
|
File without changes
|