dk-tasklib 3.0.6__tar.gz → 3.0.8__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.
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/PKG-INFO +26 -4
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/README.rst +15 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dk_tasklib.egg-info/PKG-INFO +26 -4
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dk_tasklib.egg-info/SOURCES.txt +30 -1
- dk_tasklib-3.0.8/dk_tasklib.egg-info/entry_points.txt +2 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dk_tasklib.egg-info/requires.txt +0 -1
- dk_tasklib-3.0.8/dktasklib/_version.py +1 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/commands.py +2 -3
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/docs.py +2 -2
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/entry_points/confbase.py +3 -1
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/entry_points/dktasklibcmd.py +2 -1
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/entry_points/pytemplate.py +3 -1
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/executables.py +2 -2
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/jstools.py +2 -2
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/pset.py +1 -1
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/rule.py +16 -18
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/runners.py +4 -7
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/upversion.py +3 -8
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/urlinliner.py +11 -11
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/utils.py +14 -10
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/version.py +3 -2
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/watch.py +4 -3
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/wintask.py +5 -5
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/setup.py +1 -2
- dk_tasklib-3.0.8/tests/test_clean.py +21 -0
- dk_tasklib-3.0.8/tests/test_commands_and_runners.py +115 -0
- dk_tasklib-3.0.8/tests/test_concat.py +60 -0
- dk_tasklib-3.0.8/tests/test_dktasklib_import.py +64 -0
- dk_tasklib-3.0.8/tests/test_docs.py +36 -0
- dk_tasklib-3.0.8/tests/test_docs_behavior.py +143 -0
- dk_tasklib-3.0.8/tests/test_entry_points_behavior.py +79 -0
- dk_tasklib-3.0.8/tests/test_executables.py +3 -0
- dk_tasklib-3.0.8/tests/test_executables_behavior.py +172 -0
- dk_tasklib-3.0.8/tests/test_help_behavior.py +13 -0
- dk_tasklib-3.0.8/tests/test_jstools.py +65 -0
- dk_tasklib-3.0.8/tests/test_jstools_behavior.py +165 -0
- dk_tasklib-3.0.8/tests/test_lessc.py +116 -0
- dk_tasklib-3.0.8/tests/test_lessc_behavior.py +108 -0
- dk_tasklib-3.0.8/tests/test_manage_behavior.py +130 -0
- dk_tasklib-3.0.8/tests/test_npm.py +20 -0
- dk_tasklib-3.0.8/tests/test_package_ini.py +97 -0
- dk_tasklib-3.0.8/tests/test_package_json.py +90 -0
- dk_tasklib-3.0.8/tests/test_package_setup.py +82 -0
- dk_tasklib-3.0.8/tests/test_packageinfo.py +18 -0
- dk_tasklib-3.0.8/tests/test_pset.py +110 -0
- dk_tasklib-3.0.8/tests/test_publish.py +51 -0
- dk_tasklib-3.0.8/tests/test_rule.py +28 -0
- dk_tasklib-3.0.8/tests/test_rule_and_watch.py +126 -0
- dk_tasklib-3.0.8/tests/test_taskbase_behavior.py +94 -0
- dk_tasklib-3.0.8/tests/test_upversion_behavior.py +100 -0
- dk_tasklib-3.0.8/tests/test_urlinliner_and_npm.py +82 -0
- dk_tasklib-3.0.8/tests/test_utils_behavior.py +121 -0
- dk_tasklib-3.0.8/tests/test_version.py +98 -0
- dk-tasklib-3.0.6/dk_tasklib.egg-info/entry_points.txt +0 -5
- dk-tasklib-3.0.6/dktasklib/_version.py +0 -1
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dk_tasklib.egg-info/dependency_links.txt +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dk_tasklib.egg-info/not-zip-safe +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dk_tasklib.egg-info/top_level.txt +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/__init__.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/clean.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/concat.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/entry_points/__init__.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/entry_points/taskbase.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/environment.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/help.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/lessc.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/manage.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/npm.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/package/__init__.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/package/package_interface.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/dktasklib/publish.py +0 -0
- {dk-tasklib-3.0.6 → dk_tasklib-3.0.8}/setup.cfg +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dk-tasklib
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.8
|
|
4
4
|
Summary: dk-tasklib - pyinvoke task library
|
|
5
5
|
Home-page: https://github.com/datakortet/dk-tasklib
|
|
6
6
|
Author: Bjorn Pettersen
|
|
7
7
|
Author-email: bp@datakortet.no
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Classifier: Development Status :: 3 - Alpha
|
|
11
9
|
Classifier: Intended Audience :: Developers
|
|
12
10
|
Classifier: Programming Language :: Python
|
|
@@ -15,6 +13,17 @@ Classifier: Programming Language :: Python :: 2.7
|
|
|
15
13
|
Classifier: Programming Language :: Python :: 3
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.5
|
|
17
15
|
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Dist: invoke
|
|
17
|
+
Requires-Dist: PyYAML
|
|
18
|
+
Requires-Dist: dkfileutils>=1.4.2
|
|
19
|
+
Requires-Dist: yamldirs>=1.1.8
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: summary
|
|
18
27
|
|
|
19
28
|
|
|
20
29
|
.. image:: https://travis-ci.org/datakortet/dk-tasklib.svg?branch=master
|
|
@@ -54,3 +63,16 @@ to make local changes to the source code.
|
|
|
54
63
|
See docs/ folder for documentation.
|
|
55
64
|
|
|
56
65
|
|
|
66
|
+
Development
|
|
67
|
+
-----------
|
|
68
|
+
|
|
69
|
+
Run the authoritative package checks from the repository root::
|
|
70
|
+
|
|
71
|
+
dk testpackage
|
|
72
|
+
|
|
73
|
+
The suite enforces branch-aware coverage of at least 83 percent. Build the
|
|
74
|
+
documentation with::
|
|
75
|
+
|
|
76
|
+
dk docs
|
|
77
|
+
|
|
78
|
+
The documentation is maintained against current Sphinx 8 and 9 releases.
|
|
@@ -34,3 +34,18 @@ to make local changes to the source code.
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
See docs/ folder for documentation.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Development
|
|
40
|
+
-----------
|
|
41
|
+
|
|
42
|
+
Run the authoritative package checks from the repository root::
|
|
43
|
+
|
|
44
|
+
dk testpackage
|
|
45
|
+
|
|
46
|
+
The suite enforces branch-aware coverage of at least 83 percent. Build the
|
|
47
|
+
documentation with::
|
|
48
|
+
|
|
49
|
+
dk docs
|
|
50
|
+
|
|
51
|
+
The documentation is maintained against current Sphinx 8 and 9 releases.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dk-tasklib
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.8
|
|
4
4
|
Summary: dk-tasklib - pyinvoke task library
|
|
5
5
|
Home-page: https://github.com/datakortet/dk-tasklib
|
|
6
6
|
Author: Bjorn Pettersen
|
|
7
7
|
Author-email: bp@datakortet.no
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Classifier: Development Status :: 3 - Alpha
|
|
11
9
|
Classifier: Intended Audience :: Developers
|
|
12
10
|
Classifier: Programming Language :: Python
|
|
@@ -15,6 +13,17 @@ Classifier: Programming Language :: Python :: 2.7
|
|
|
15
13
|
Classifier: Programming Language :: Python :: 3
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.5
|
|
17
15
|
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Dist: invoke
|
|
17
|
+
Requires-Dist: PyYAML
|
|
18
|
+
Requires-Dist: dkfileutils>=1.4.2
|
|
19
|
+
Requires-Dist: yamldirs>=1.1.8
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: summary
|
|
18
27
|
|
|
19
28
|
|
|
20
29
|
.. image:: https://travis-ci.org/datakortet/dk-tasklib.svg?branch=master
|
|
@@ -54,3 +63,16 @@ to make local changes to the source code.
|
|
|
54
63
|
See docs/ folder for documentation.
|
|
55
64
|
|
|
56
65
|
|
|
66
|
+
Development
|
|
67
|
+
-----------
|
|
68
|
+
|
|
69
|
+
Run the authoritative package checks from the repository root::
|
|
70
|
+
|
|
71
|
+
dk testpackage
|
|
72
|
+
|
|
73
|
+
The suite enforces branch-aware coverage of at least 83 percent. Build the
|
|
74
|
+
documentation with::
|
|
75
|
+
|
|
76
|
+
dk docs
|
|
77
|
+
|
|
78
|
+
The documentation is maintained against current Sphinx 8 and 9 releases.
|
|
@@ -37,4 +37,33 @@ dktasklib/entry_points/dktasklibcmd.py
|
|
|
37
37
|
dktasklib/entry_points/pytemplate.py
|
|
38
38
|
dktasklib/entry_points/taskbase.py
|
|
39
39
|
dktasklib/package/__init__.py
|
|
40
|
-
dktasklib/package/package_interface.py
|
|
40
|
+
dktasklib/package/package_interface.py
|
|
41
|
+
tests/test_clean.py
|
|
42
|
+
tests/test_commands_and_runners.py
|
|
43
|
+
tests/test_concat.py
|
|
44
|
+
tests/test_dktasklib_import.py
|
|
45
|
+
tests/test_docs.py
|
|
46
|
+
tests/test_docs_behavior.py
|
|
47
|
+
tests/test_entry_points_behavior.py
|
|
48
|
+
tests/test_executables.py
|
|
49
|
+
tests/test_executables_behavior.py
|
|
50
|
+
tests/test_help_behavior.py
|
|
51
|
+
tests/test_jstools.py
|
|
52
|
+
tests/test_jstools_behavior.py
|
|
53
|
+
tests/test_lessc.py
|
|
54
|
+
tests/test_lessc_behavior.py
|
|
55
|
+
tests/test_manage_behavior.py
|
|
56
|
+
tests/test_npm.py
|
|
57
|
+
tests/test_package_ini.py
|
|
58
|
+
tests/test_package_json.py
|
|
59
|
+
tests/test_package_setup.py
|
|
60
|
+
tests/test_packageinfo.py
|
|
61
|
+
tests/test_pset.py
|
|
62
|
+
tests/test_publish.py
|
|
63
|
+
tests/test_rule.py
|
|
64
|
+
tests/test_rule_and_watch.py
|
|
65
|
+
tests/test_taskbase_behavior.py
|
|
66
|
+
tests/test_upversion_behavior.py
|
|
67
|
+
tests/test_urlinliner_and_npm.py
|
|
68
|
+
tests/test_utils_behavior.py
|
|
69
|
+
tests/test_version.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '3.0.8'
|
|
@@ -5,7 +5,6 @@ import invoke
|
|
|
5
5
|
|
|
6
6
|
from .executables import exe
|
|
7
7
|
from .utils import fmt
|
|
8
|
-
from past.builtins import basestring
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
default_command_policy = dict(
|
|
@@ -58,12 +57,12 @@ class Command(object):
|
|
|
58
57
|
res += flag
|
|
59
58
|
else:
|
|
60
59
|
if self.policy['negative_bool'] == 'prefix':
|
|
61
|
-
res += '--no' + flag
|
|
60
|
+
res += '--no-' + flag.lstrip('-')
|
|
62
61
|
|
|
63
62
|
elif isinstance(v, (list, tuple)) and v:
|
|
64
63
|
res += flag + '=' + self.policy['list_join'].join(str(item) for item in v)
|
|
65
64
|
|
|
66
|
-
elif isinstance(v,
|
|
65
|
+
elif isinstance(v, str):
|
|
67
66
|
res += flag + '="%s"' % v
|
|
68
67
|
|
|
69
68
|
else:
|
|
@@ -96,7 +96,7 @@ def create_docs_directory(ctx, force=False):
|
|
|
96
96
|
ctx.pkg.docs.makedirs('_templates')
|
|
97
97
|
confbase = DIRNAME / 'entry_points/confbase.py'
|
|
98
98
|
txt = confbase.read('rb')
|
|
99
|
-
txt = txt.replace('\r\n', '\n')
|
|
99
|
+
txt = txt.replace(b'\r\n', b'\n')
|
|
100
100
|
t = PyTemplate(txt)
|
|
101
101
|
|
|
102
102
|
(ctx.pkg.docs / 'conf.py').write(t.substitute(
|
|
@@ -117,7 +117,7 @@ def create_index(ctx, force=False):
|
|
|
117
117
|
sys.exit(1)
|
|
118
118
|
confbase = DIRNAME / 'entry_points/index.rst'
|
|
119
119
|
txt = confbase.read('rb')
|
|
120
|
-
txt = txt.replace('\r\n', '\n')
|
|
120
|
+
txt = txt.replace(b'\r\n', b'\n')
|
|
121
121
|
t = PyTemplate(txt)
|
|
122
122
|
|
|
123
123
|
index.write(t.substitute(
|
|
@@ -164,7 +164,9 @@ texinfo_documents = [
|
|
|
164
164
|
# -- Options for intersphinx extension ---------------------------------------
|
|
165
165
|
|
|
166
166
|
# Example configuration for intersphinx: refer to the Python standard library.
|
|
167
|
-
intersphinx_mapping = {
|
|
167
|
+
intersphinx_mapping = {
|
|
168
|
+
'python': ('https://docs.python.org/3', None),
|
|
169
|
+
}
|
|
168
170
|
|
|
169
171
|
# -- Options for todo extension ----------------------------------------------
|
|
170
172
|
|
|
@@ -49,6 +49,7 @@ def create_docs_cmd(args):
|
|
|
49
49
|
txt = txt.replace(b'\r\n', b'\n')
|
|
50
50
|
t = PyTemplate(txt)
|
|
51
51
|
|
|
52
|
+
docsdir.makedirs()
|
|
52
53
|
(docsdir / 'conf.py').write(t.substitute(
|
|
53
54
|
VERSION=run('python setup.py --version'),
|
|
54
55
|
PACKAGE=run('python setup.py --name'),
|
|
@@ -64,7 +65,7 @@ def add_django_to_docs_conf():
|
|
|
64
65
|
print("./docs/conf.py already contains django.setup()")
|
|
65
66
|
return
|
|
66
67
|
|
|
67
|
-
src = conf_file.read('
|
|
68
|
+
src = conf_file.read('r')
|
|
68
69
|
pre, post = src.split('\n\n', 1)
|
|
69
70
|
conf_file.write(
|
|
70
71
|
pre + "\n\n" +
|
|
@@ -7,7 +7,9 @@ class PyTemplate(Template):
|
|
|
7
7
|
Template strings that can replace ##{PATTERN} instances.
|
|
8
8
|
"""
|
|
9
9
|
def __init__(self, t):
|
|
10
|
-
|
|
10
|
+
if isinstance(t, bytes):
|
|
11
|
+
t = t.decode('u8')
|
|
12
|
+
super(PyTemplate, self).__init__(t.replace('$', '$$').replace('##{', '${'))
|
|
11
13
|
|
|
12
14
|
def substitute(self, *args, **kw):
|
|
13
15
|
return super(PyTemplate, self).substitute(
|
|
@@ -82,9 +82,9 @@ class Executables(object):
|
|
|
82
82
|
if win32:
|
|
83
83
|
# self.ctx.run(cmd, echo=True)
|
|
84
84
|
runners.run(cmd)
|
|
85
|
-
|
|
85
|
+
exepath = get_executable(exename)
|
|
86
86
|
# generate signing key if downloading wheel
|
|
87
|
-
runners.run(
|
|
87
|
+
runners.run(exepath + ' keygen')
|
|
88
88
|
else:
|
|
89
89
|
raise MissingCommand("Missing wheel (%s)" % cmd)
|
|
90
90
|
print('Your ~/.pypirc file should have a [pypi] section instead of a [server-login] section')
|
|
@@ -241,9 +241,9 @@ def browserify(ctx,
|
|
|
241
241
|
ctx.run(cmd)
|
|
242
242
|
with open(dest, 'rb') as fp:
|
|
243
243
|
txt = fp.read()
|
|
244
|
-
if '\r\n' in txt:
|
|
244
|
+
if b'\r\n' in txt:
|
|
245
245
|
with open(dest, 'wb') as fp:
|
|
246
|
-
fp.write(txt.replace('\r\n', '\n'))
|
|
246
|
+
fp.write(txt.replace(b'\r\n', b'\n'))
|
|
247
247
|
return dest
|
|
248
248
|
|
|
249
249
|
|
|
@@ -48,28 +48,26 @@ class BuildRule(object):
|
|
|
48
48
|
def topsort(self, tasklist):
|
|
49
49
|
"""Topological sort
|
|
50
50
|
"""
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
permanent = set()
|
|
52
|
+
temporary = set()
|
|
53
53
|
res = []
|
|
54
54
|
|
|
55
|
-
def visit(
|
|
56
|
-
|
|
55
|
+
def visit(task):
|
|
56
|
+
name = id(task)
|
|
57
|
+
if name in temporary:
|
|
57
58
|
raise ValueError("Circularity", name, res)
|
|
58
|
-
if
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
if name in permanent:
|
|
60
|
+
return
|
|
61
|
+
temporary.add(name)
|
|
62
|
+
for dependency in task.requires:
|
|
63
|
+
visit(dependency)
|
|
64
|
+
permanent.add(name)
|
|
65
|
+
temporary.remove(name)
|
|
66
|
+
res.append(task)
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if not unmarked:
|
|
70
|
-
return [tasks[k] for k in res]
|
|
71
|
-
name, task = unmarked.pop()
|
|
72
|
-
visit(name, task)
|
|
68
|
+
for task in tasklist:
|
|
69
|
+
visit(task)
|
|
70
|
+
return res
|
|
73
71
|
|
|
74
72
|
|
|
75
73
|
# @task
|
|
@@ -10,18 +10,15 @@ class Result(str):
|
|
|
10
10
|
|
|
11
11
|
def run(cmdline, throw=False):
|
|
12
12
|
try:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
cmdline,
|
|
16
|
-
shell=True
|
|
17
|
-
) # .decode('u8') ## (can't decode since Result is a str)
|
|
18
|
-
)
|
|
13
|
+
output = subprocess.check_output(cmdline, shell=True)
|
|
14
|
+
res = Result(output.decode('u8'))
|
|
19
15
|
res.cmd = cmdline
|
|
20
16
|
return res
|
|
21
17
|
except subprocess.CalledProcessError as e:
|
|
22
18
|
if throw:
|
|
23
19
|
raise
|
|
24
|
-
|
|
20
|
+
output = e.output.decode('u8') if isinstance(e.output, bytes) else e.output
|
|
21
|
+
res = Result(output)
|
|
25
22
|
res.cmd = cmdline
|
|
26
23
|
res.returncode = e.returncode
|
|
27
24
|
return res
|
|
@@ -47,13 +47,8 @@ def _replace_version(fname, cur_version, new_version):
|
|
|
47
47
|
with open(fname, 'rb') as fp:
|
|
48
48
|
txt = fp.read()
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
uc = False
|
|
53
|
-
except UnicodeDecodeError:
|
|
54
|
-
uc = True
|
|
55
|
-
txt = txt.decode('u8')
|
|
56
|
-
|
|
50
|
+
cur_version = cur_version.encode('u8')
|
|
51
|
+
new_version = new_version.encode('u8')
|
|
57
52
|
if cur_version not in txt: # pragma: nocover
|
|
58
53
|
# warnings.warn("Did not find %r in %r" % (cur_version, fname))
|
|
59
54
|
return False
|
|
@@ -67,7 +62,7 @@ def _replace_version(fname, cur_version, new_version):
|
|
|
67
62
|
txt = txt.replace(cur_version, new_version)
|
|
68
63
|
|
|
69
64
|
with open(fname, 'wb') as fp:
|
|
70
|
-
fp.write(txt
|
|
65
|
+
fp.write(txt)
|
|
71
66
|
return 1
|
|
72
67
|
|
|
73
68
|
|
|
@@ -5,7 +5,7 @@ from dktasklib.wintask import task
|
|
|
5
5
|
import base64
|
|
6
6
|
import os
|
|
7
7
|
import re
|
|
8
|
-
import
|
|
8
|
+
from urllib.request import urlopen
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def inline_data(data, type='image/png', name=""):
|
|
@@ -15,7 +15,7 @@ def inline_data(data, type='image/png', name=""):
|
|
|
15
15
|
print("%s is too big (%d bytes), max is 10KB" % (name, len(data)))
|
|
16
16
|
return name
|
|
17
17
|
|
|
18
|
-
encoded = base64.b64encode(data)
|
|
18
|
+
encoded = base64.b64encode(data).decode('ascii')
|
|
19
19
|
return 'data:{type};base64,{encoded}'.format(
|
|
20
20
|
type=type,
|
|
21
21
|
encoded=encoded.replace('\n', '')
|
|
@@ -36,12 +36,12 @@ def inline_file(fname):
|
|
|
36
36
|
def inline_url(uri):
|
|
37
37
|
"""Fetch ``uri`` and inline.
|
|
38
38
|
"""
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
with urlopen(uri) as fp:
|
|
40
|
+
return inline_data(
|
|
41
|
+
fp.read(),
|
|
42
|
+
type=fp.headers['Content-Type'],
|
|
43
|
+
name=uri
|
|
44
|
+
)
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
@task(
|
|
@@ -69,7 +69,7 @@ def inline(ctx, fname):
|
|
|
69
69
|
"""
|
|
70
70
|
lines = open(fname).readlines()
|
|
71
71
|
output_fname = os.path.splitext(fname)[0]
|
|
72
|
-
with open(output_fname, '
|
|
72
|
+
with open(output_fname, 'w') as fp:
|
|
73
73
|
for line in lines:
|
|
74
74
|
if line.startswith('@'):
|
|
75
75
|
varname, content = line.split(':', 1)
|
|
@@ -82,12 +82,12 @@ def inline(ctx, fname):
|
|
|
82
82
|
varname=varname,
|
|
83
83
|
content=data
|
|
84
84
|
)
|
|
85
|
-
fp.
|
|
85
|
+
fp.write(line)
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
@task
|
|
89
89
|
def list_urls(ctx, filename):
|
|
90
90
|
"""List all url(..) targets in the filename.
|
|
91
91
|
"""
|
|
92
|
-
for match in re.findall(r'url\((.*?)\)', open(filename
|
|
92
|
+
for match in re.findall(r'url\((.*?)\)', open(filename).read()):
|
|
93
93
|
print(match)
|
|
@@ -125,7 +125,7 @@ def dest_is_newer_than_source(src, dst):
|
|
|
125
125
|
if not os.path.exists(dst):
|
|
126
126
|
return False
|
|
127
127
|
if not os.path.exists(src):
|
|
128
|
-
raise ValueError("Source does not exist: " + src)
|
|
128
|
+
raise ValueError("Source does not exist: " + str(src))
|
|
129
129
|
return os.path.getmtime(src) < os.path.getmtime(dst)
|
|
130
130
|
|
|
131
131
|
|
|
@@ -186,12 +186,14 @@ def env(**kw):
|
|
|
186
186
|
currentvals = {k: os.environ.get(k) for k in kw}
|
|
187
187
|
for k, v in kw.items():
|
|
188
188
|
os.environ[k] = str(v)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
try:
|
|
190
|
+
yield
|
|
191
|
+
finally:
|
|
192
|
+
for k in kw:
|
|
193
|
+
if currentvals[k] is None:
|
|
194
|
+
os.environ.pop(k, None)
|
|
195
|
+
else:
|
|
196
|
+
os.environ[k] = currentvals[k]
|
|
195
197
|
|
|
196
198
|
|
|
197
199
|
@contextmanager
|
|
@@ -206,9 +208,11 @@ def cd(directory):
|
|
|
206
208
|
|
|
207
209
|
"""
|
|
208
210
|
cwd = os.getcwd()
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
try:
|
|
212
|
+
os.chdir(directory)
|
|
213
|
+
yield
|
|
214
|
+
finally:
|
|
215
|
+
os.chdir(cwd)
|
|
212
216
|
|
|
213
217
|
|
|
214
218
|
def find_pymodule(dotted_name):
|
|
@@ -51,7 +51,8 @@ def get_version(ctx, fname, kind='pkg'):
|
|
|
51
51
|
return ctx.pkg.version
|
|
52
52
|
|
|
53
53
|
elif kind == "hash":
|
|
54
|
-
|
|
54
|
+
directory = fname.dirname() or Path('.')
|
|
55
|
+
md5 = directory / '.md5'
|
|
55
56
|
if md5.exists():
|
|
56
57
|
return md5.open().read()
|
|
57
58
|
return hashlib.md5(open(fname, 'rb').read()).hexdigest()
|
|
@@ -77,7 +78,7 @@ def copy_to_version(ctx, source, outputdir=None, kind="pkg", force=False):
|
|
|
77
78
|
"""
|
|
78
79
|
# where to place the versioned file..
|
|
79
80
|
source = Path(source)
|
|
80
|
-
outputdir = Path(outputdir) if outputdir else source.dirname()
|
|
81
|
+
outputdir = Path(outputdir) if outputdir else source.dirname() or Path('.')
|
|
81
82
|
outputdir.makedirs()
|
|
82
83
|
dst_fname = source.basename()
|
|
83
84
|
if '{version}' not in str(dst_fname):
|
|
@@ -40,7 +40,7 @@ class FileModified(FileSystemEventHandler):
|
|
|
40
40
|
self.action = action
|
|
41
41
|
|
|
42
42
|
def on_modified(self, event):
|
|
43
|
-
if event.src_path != self.fname:
|
|
43
|
+
if Path(event.src_path).abspath() != self.fname:
|
|
44
44
|
return
|
|
45
45
|
self.action(event)
|
|
46
46
|
|
|
@@ -55,10 +55,11 @@ class DirectoryModified(FileSystemEventHandler):
|
|
|
55
55
|
|
|
56
56
|
def on_modified(self, event):
|
|
57
57
|
# print event.src_path, self.path, self.ext
|
|
58
|
-
|
|
58
|
+
event_path = Path(event.src_path).abspath()
|
|
59
|
+
if not event_path.startswith(self.path):
|
|
59
60
|
# print ' path different'
|
|
60
61
|
return
|
|
61
|
-
if self.ext and not
|
|
62
|
+
if self.ext and not event_path.endswith(self.ext):
|
|
62
63
|
# print ' ext different'
|
|
63
64
|
return
|
|
64
65
|
self.action(event)
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import os
|
|
3
3
|
import sys
|
|
4
|
-
import invoke
|
|
5
4
|
|
|
6
5
|
try:
|
|
7
6
|
from invoke import ctask as _task
|
|
8
7
|
except ImportError:
|
|
9
8
|
from invoke import task as _task
|
|
10
9
|
|
|
11
|
-
if invoke.__version_info__ < (0, 22): # pragma: nocover
|
|
12
|
-
|
|
13
|
-
elif invoke.__version_info__ >= (0, 22):
|
|
14
|
-
|
|
10
|
+
# if invoke.__version_info__ < (0, 22): # pragma: nocover
|
|
11
|
+
# _should_patch = True
|
|
12
|
+
# elif invoke.__version_info__ >= (0, 22):
|
|
13
|
+
# _should_patch = False
|
|
15
14
|
|
|
15
|
+
_should_patch = False
|
|
16
16
|
|
|
17
17
|
if _should_patch: # pragma: nocover
|
|
18
18
|
# https://github.com/pyinvoke/invoke/pull/407
|
|
@@ -18,7 +18,7 @@ Programming Language :: Python :: 3.5
|
|
|
18
18
|
Topic :: Software Development :: Libraries
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
|
-
version = '3.0.
|
|
21
|
+
version = '3.0.8'
|
|
22
22
|
DIRNAME = os.path.dirname(__file__)
|
|
23
23
|
|
|
24
24
|
|
|
@@ -29,7 +29,6 @@ setuptools.setup(
|
|
|
29
29
|
"invoke",
|
|
30
30
|
"PyYAML",
|
|
31
31
|
"dkfileutils>=1.4.2",
|
|
32
|
-
"pathtools",
|
|
33
32
|
"yamldirs>=1.1.8",
|
|
34
33
|
],
|
|
35
34
|
author='Bjorn Pettersen',
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
from yamldirs import create_files
|
|
6
|
+
from dktasklib import clean
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_clean(ctx):
|
|
10
|
+
files = """
|
|
11
|
+
build:
|
|
12
|
+
- a
|
|
13
|
+
- b
|
|
14
|
+
- c:
|
|
15
|
+
- d
|
|
16
|
+
- e
|
|
17
|
+
"""
|
|
18
|
+
with create_files(files) as directory:
|
|
19
|
+
clean.clean(ctx.init(), 'c')
|
|
20
|
+
assert set(os.listdir('build')) == {'a', 'b', 'c'}
|
|
21
|
+
assert os.listdir('build/c') == []
|