dk-tasklib 3.0.8__tar.gz → 3.0.9__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.
Files changed (75) hide show
  1. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/PKG-INFO +4 -4
  2. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/PKG-INFO +4 -4
  3. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/SOURCES.txt +0 -6
  4. dk_tasklib-3.0.9/dktasklib/_version.py +1 -0
  5. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/clean.py +0 -2
  6. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/commands.py +1 -3
  7. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/concat.py +0 -22
  8. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/docs.py +0 -3
  9. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/entry_points/__init__.py +0 -2
  10. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/entry_points/confbase.py +11 -13
  11. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/entry_points/dktasklibcmd.py +0 -3
  12. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/entry_points/pytemplate.py +2 -3
  13. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/entry_points/taskbase.py +2 -32
  14. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/environment.py +1 -1
  15. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/executables.py +1 -22
  16. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/help.py +0 -2
  17. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/jstools.py +0 -81
  18. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/lessc.py +0 -2
  19. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/manage.py +0 -9
  20. dk_tasklib-3.0.9/dktasklib/npm.py +19 -0
  21. dk_tasklib-3.0.9/dktasklib/package/__init__.py +31 -0
  22. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/package/package_interface.py +1 -5
  23. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/pset.py +2 -5
  24. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/publish.py +0 -8
  25. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/rule.py +1 -24
  26. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/runners.py +0 -2
  27. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/upversion.py +0 -3
  28. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/urlinliner.py +0 -3
  29. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/utils.py +0 -3
  30. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/version.py +0 -9
  31. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/watch.py +3 -8
  32. dk_tasklib-3.0.9/dktasklib/wintask.py +4 -0
  33. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/setup.cfg +0 -3
  34. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/setup.py +4 -5
  35. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_clean.py +0 -2
  36. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_concat.py +0 -2
  37. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_dktasklib_import.py +0 -2
  38. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_docs_behavior.py +2 -2
  39. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_entry_points_behavior.py +3 -3
  40. dk_tasklib-3.0.9/tests/test_executables.py +0 -0
  41. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_packageinfo.py +0 -1
  42. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_pset.py +0 -2
  43. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_publish.py +0 -2
  44. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_rule.py +0 -1
  45. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_taskbase_behavior.py +3 -22
  46. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_version.py +0 -2
  47. dk_tasklib-3.0.8/dktasklib/_version.py +0 -1
  48. dk_tasklib-3.0.8/dktasklib/npm.py +0 -62
  49. dk_tasklib-3.0.8/dktasklib/package/__init__.py +0 -57
  50. dk_tasklib-3.0.8/dktasklib/wintask.py +0 -35
  51. dk_tasklib-3.0.8/tests/test_docs.py +0 -36
  52. dk_tasklib-3.0.8/tests/test_executables.py +0 -3
  53. dk_tasklib-3.0.8/tests/test_jstools.py +0 -65
  54. dk_tasklib-3.0.8/tests/test_npm.py +0 -20
  55. dk_tasklib-3.0.8/tests/test_package_ini.py +0 -97
  56. dk_tasklib-3.0.8/tests/test_package_json.py +0 -90
  57. dk_tasklib-3.0.8/tests/test_package_setup.py +0 -82
  58. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/README.rst +0 -0
  59. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/dependency_links.txt +0 -0
  60. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/entry_points.txt +0 -0
  61. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/not-zip-safe +0 -0
  62. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/requires.txt +0 -0
  63. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dk_tasklib.egg-info/top_level.txt +0 -0
  64. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/dktasklib/__init__.py +0 -0
  65. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_commands_and_runners.py +0 -0
  66. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_executables_behavior.py +0 -0
  67. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_help_behavior.py +0 -0
  68. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_jstools_behavior.py +0 -0
  69. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_lessc.py +0 -0
  70. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_lessc_behavior.py +0 -0
  71. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_manage_behavior.py +0 -0
  72. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_rule_and_watch.py +0 -0
  73. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_upversion_behavior.py +0 -0
  74. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_urlinliner_and_npm.py +0 -0
  75. {dk_tasklib-3.0.8 → dk_tasklib-3.0.9}/tests/test_utils_behavior.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dk-tasklib
3
- Version: 3.0.8
3
+ Version: 3.0.9
4
4
  Summary: dk-tasklib - pyinvoke task library
5
5
  Home-page: https://github.com/datakortet/dk-tasklib
6
6
  Author: Bjorn Pettersen
@@ -8,10 +8,10 @@ Author-email: bp@datakortet.no
8
8
  Classifier: Development Status :: 3 - Alpha
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: Programming Language :: Python
11
- Classifier: Programming Language :: Python :: 2
12
- Classifier: Programming Language :: Python :: 2.7
13
11
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.5
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Topic :: Software Development :: Libraries
16
16
  Requires-Dist: invoke
17
17
  Requires-Dist: PyYAML
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dk-tasklib
3
- Version: 3.0.8
3
+ Version: 3.0.9
4
4
  Summary: dk-tasklib - pyinvoke task library
5
5
  Home-page: https://github.com/datakortet/dk-tasklib
6
6
  Author: Bjorn Pettersen
@@ -8,10 +8,10 @@ Author-email: bp@datakortet.no
8
8
  Classifier: Development Status :: 3 - Alpha
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: Programming Language :: Python
11
- Classifier: Programming Language :: Python :: 2
12
- Classifier: Programming Language :: Python :: 2.7
13
11
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.5
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Topic :: Software Development :: Libraries
16
16
  Requires-Dist: invoke
17
17
  Requires-Dist: PyYAML
@@ -42,21 +42,15 @@ tests/test_clean.py
42
42
  tests/test_commands_and_runners.py
43
43
  tests/test_concat.py
44
44
  tests/test_dktasklib_import.py
45
- tests/test_docs.py
46
45
  tests/test_docs_behavior.py
47
46
  tests/test_entry_points_behavior.py
48
47
  tests/test_executables.py
49
48
  tests/test_executables_behavior.py
50
49
  tests/test_help_behavior.py
51
- tests/test_jstools.py
52
50
  tests/test_jstools_behavior.py
53
51
  tests/test_lessc.py
54
52
  tests/test_lessc_behavior.py
55
53
  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
54
  tests/test_packageinfo.py
61
55
  tests/test_pset.py
62
56
  tests/test_publish.py
@@ -0,0 +1 @@
1
+ __version__ = '3.0.9'
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from dktasklib.wintask import task
3
2
 
4
3
 
@@ -6,5 +5,4 @@ from dktasklib.wintask import task
6
5
  def clean(ctx, directory):
7
6
  """Remove all contents from build subdirectory `directory`.
8
7
  """
9
- # ctx.run("rm -rf build/{directory}/*".format(directory=directory), shell=os.environ['COMSPEC'])
10
8
  ctx.run("rm -rf build/{directory}/*".format(directory=directory))
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  import os
3
2
  import re
4
3
  import invoke
@@ -13,7 +12,7 @@ default_command_policy = dict(
13
12
  )
14
13
 
15
14
 
16
- class Command(object):
15
+ class Command:
17
16
  def __init__(self, name, argspec="",
18
17
  requirements=(),
19
18
  policy=default_command_policy,
@@ -45,7 +44,6 @@ class Command(object):
45
44
  def _kw_to_opts(self, kw):
46
45
  res = ""
47
46
  for k, v in kw.items():
48
- # print 'k,v,res:', k, v, `res`
49
47
  if k in self.params: # skip conversion of parameters to argspec
50
48
  continue
51
49
 
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- from __future__ import print_function
3
1
  import os
4
2
  import sys
5
3
 
@@ -43,8 +41,6 @@ def fix_line_endings(fname, eol=b'\n'):
43
41
  def copy(ctx, source, dest, force=False):
44
42
  """Copy ``source`` to ``dest``, which can be a file or directory.
45
43
  """
46
- # print "COPY:", locals()
47
- # print "COPY:", ctx.force, ctx.verbose
48
44
  if source == dest:
49
45
  return dest
50
46
 
@@ -54,7 +50,6 @@ def copy(ctx, source, dest, force=False):
54
50
  if sys.platform == 'win32':
55
51
  if force:
56
52
  flags += " /Y"
57
- # print 'copy {flags} {source} {dest}'.format(**locals())
58
53
  ctx.run('copy {flags} {source} {dest}'.format(**locals()))
59
54
  else: # pragma: nocover
60
55
  if force:
@@ -76,23 +71,6 @@ def concat(ctx, dest, *sources, **kw):
76
71
  out.writelines(inp.readlines())
77
72
  out.write('\n')
78
73
 
79
- # flags = ""
80
- # if sys.platform == 'win32':
81
- # if force:
82
- # flags += " /Y"
83
- # source = '+'.join(sources)
84
- # source = source.replace('/', '\\')
85
- # ctx.run('copy {flags} {source} {dest}'.format(**locals()))
86
- # else: # pragma: nocover
87
- # if force:
88
- # pass
89
- # # flags += " --force"
90
- # source = ' '.join(sources)
91
- # # print 'cat {flags} {source} > {dest}'.format(**locals())
92
- # ctx.run('cat {flags} {source} > {dest}'.format(**locals()))
93
-
94
74
  fix_line_endings(dest)
95
- # if len(line_endings(dest)) > 1:
96
- # fix_line_endings(dest)
97
75
 
98
76
  return dest
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- from __future__ import print_function
3
1
  import datetime
4
2
  import os
5
3
  import sys
@@ -173,7 +171,6 @@ def build(ctx, clean=False, browse=False, warn=False,
173
171
  """
174
172
  Build the project's Sphinx docs.
175
173
  """
176
- # import pdb;pdb.set_trace()
177
174
  if not force and not changed(ctx.pkg.docs):
178
175
  print("""
179
176
  No changes detected in {}, add --force to build docs anyway.
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """
4
2
  """
5
3
 
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
1
  # Configuration file for the Sphinx documentation builder.
4
2
  #
5
3
  # This file does only contain a selection of the most common options. For a
@@ -19,14 +17,14 @@ sys.path.insert(0, os.path.abspath('..'))
19
17
 
20
18
  # -- Project information -----------------------------------------------------
21
19
 
22
- project = u'##{PACKAGE}'
23
- copyright = u'##{YEAR}, ##{AUTHOR}'
24
- author = u'##{AUTHOR}'
20
+ project = '##{PACKAGE}'
21
+ copyright = '##{YEAR}, ##{AUTHOR}'
22
+ author = '##{AUTHOR}'
25
23
 
26
24
  # The short X.Y version
27
- version = u'##{VERSION}'
25
+ version = '##{VERSION}'
28
26
  # The full version, including alpha/beta/rc tags
29
- release = u'##{VERSION}'
27
+ release = '##{VERSION}'
30
28
 
31
29
 
32
30
  # -- General configuration ---------------------------------------------------
@@ -62,12 +60,12 @@ master_doc = 'index'
62
60
  #
63
61
  # This is also used if you do content translation via gettext catalogs.
64
62
  # Usually you set "language" from the command line for these cases.
65
- language = u'en'
63
+ language = 'en'
66
64
 
67
65
  # List of patterns, relative to source directory, that match files and
68
66
  # directories to ignore when looking for source files.
69
67
  # This pattern also affects html_static_path and html_extra_path .
70
- exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
68
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
71
69
 
72
70
  # The name of the Pygments (syntax highlighting) style to use.
73
71
  pygments_style = 'sphinx'
@@ -132,8 +130,8 @@ latex_elements = {
132
130
  # (source start file, target name, title,
133
131
  # author, documentclass [howto, manual, or own class]).
134
132
  latex_documents = [
135
- (master_doc, '##{PACKAGE}.tex', u'##{PACKAGE} Documentation',
136
- u'##{AUTHOR}', 'manual'),
133
+ (master_doc, '##{PACKAGE}.tex', '##{PACKAGE} Documentation',
134
+ '##{AUTHOR}', 'manual'),
137
135
  ]
138
136
 
139
137
 
@@ -142,7 +140,7 @@ latex_documents = [
142
140
  # One entry per manual page. List of tuples
143
141
  # (source start file, name, description, authors, manual section).
144
142
  man_pages = [
145
- (master_doc, '##{PACKAGE}', u'##{PACKAGE} Documentation',
143
+ (master_doc, '##{PACKAGE}', '##{PACKAGE} Documentation',
146
144
  [author], 1)
147
145
  ]
148
146
 
@@ -153,7 +151,7 @@ man_pages = [
153
151
  # (source start file, target name, title, author,
154
152
  # dir menu entry, description, category)
155
153
  texinfo_documents = [
156
- (master_doc, '##{PACKAGE}', u'##{PACKAGE} Documentation',
154
+ (master_doc, '##{PACKAGE}', '##{PACKAGE} Documentation',
157
155
  author, '##{PACKAGE}', 'One line description of project.',
158
156
  'Miscellaneous'),
159
157
  ]
@@ -1,8 +1,5 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Commands installed by setup.py
4
2
  """
5
- from __future__ import print_function
6
3
  # pragma: nocover
7
4
  import argparse
8
5
  import datetime
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from string import Template
3
2
 
4
3
 
@@ -9,9 +8,9 @@ class PyTemplate(Template):
9
8
  def __init__(self, t):
10
9
  if isinstance(t, bytes):
11
10
  t = t.decode('u8')
12
- super(PyTemplate, self).__init__(t.replace('$', '$$').replace('##{', '${'))
11
+ super().__init__(t.replace('$', '$$').replace('##{', '${'))
13
12
 
14
13
  def substitute(self, *args, **kw):
15
- return super(PyTemplate, self).substitute(
14
+ return super().substitute(
16
15
  **{k.upper(): v for k, v in kw.items()}
17
16
  )
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Base version of package/tasks.py, created by version ##{VERSION} of
4
3
 
@@ -25,7 +24,6 @@ will fit your use case.
25
24
 
26
25
  """
27
26
  # pragma: nocover
28
- from __future__ import print_function
29
27
  import os
30
28
  import warnings
31
29
 
@@ -35,7 +33,6 @@ from dktasklib.wintask import task
35
33
  from invoke import Collection
36
34
 
37
35
  from dktasklib import docs as doctools
38
- from dktasklib import jstools
39
36
  from dktasklib import lessc
40
37
  from dktasklib import version, upversion
41
38
  from dktasklib.manage import collectstatic
@@ -58,12 +55,6 @@ DJANGO_SETTINGS_MODULE = ''
58
55
  # there should be a mypkg/mypkg/less/mypkg.less file that imports any other
59
56
  # needed sources
60
57
 
61
- # .jsx (es6 source)
62
- # ------------------
63
- # list any .jsx files here. Only filename.jsx (don't include the path).
64
- # The files should reside in mypkg/mypkg/js/ directory.
65
- JSX_FILENAMES = []
66
-
67
58
  # ============================================================================
68
59
  # autodoc is in a separate process, so can't use settings.configure().
69
60
  HAVE_SETTINGS = bool(DJANGO_SETTINGS_MODULE)
@@ -76,23 +67,10 @@ WARN_ABOUT_SETTINGS = not bool(DJANGO_SETTINGS_MODULE)
76
67
 
77
68
 
78
69
  @task
79
- def build_js(ctx, force=False):
80
- """Build all javascript files.
81
- """
82
- for fname in JSX_FILENAMES:
83
- jstools.babel(
84
- ctx,
85
- '{pkg.source_js}/' + fname,
86
- '{pkg.django_static}/{pkg.name}/js/' + fname + '.js',
87
- force=force
88
- )
89
-
90
-
91
- @task
92
- def build(ctx, less=False, docs=False, js=False, force=False):
70
+ def build(ctx, less=False, docs=False, force=False):
93
71
  """Build everything and collectstatic.
94
72
  """
95
- specified = any([less, docs, js])
73
+ specified = any([less, docs])
96
74
  buildall = not specified
97
75
 
98
76
  if buildall or less:
@@ -118,9 +96,6 @@ def build(ctx, less=False, docs=False, js=False, force=False):
118
96
  )
119
97
  doctools.build(ctx, force=force)
120
98
 
121
- if buildall or js:
122
- build_js(ctx, force)
123
-
124
99
  if HAVE_SETTINGS and (force or changed(ctx.pkg.django_static)):
125
100
  collectstatic(ctx, DJANGO_SETTINGS_MODULE, force=force)
126
101
 
@@ -134,10 +109,6 @@ def watch(ctx):
134
109
  path='{pkg.source_less}', ext='.less',
135
110
  action=lambda e: build(ctx, less=True)
136
111
  )
137
- watcher.watch_directory(
138
- path='{pkg.source_js}', ext='.jsx',
139
- action=lambda e: build(ctx, js=True)
140
- )
141
112
  watcher.watch_directory(
142
113
  path='{pkg.docs}', ext='.rst',
143
114
  action=lambda e: build(ctx, docs=True)
@@ -149,7 +120,6 @@ def watch(ctx):
149
120
  ns = Collection(
150
121
  build,
151
122
  watch,
152
- build_js,
153
123
  lessc,
154
124
  doctools,
155
125
  version, upversion,
@@ -3,7 +3,7 @@ Global state.
3
3
  """
4
4
 
5
5
 
6
- class Environment(object):
6
+ class Environment:
7
7
  def __call__(self, ctx):
8
8
  return ctx
9
9
 
@@ -1,4 +1,3 @@
1
- # from functools import wraps
2
1
  import sys
3
2
  import warnings
4
3
 
@@ -16,7 +15,7 @@ class MissingCommand(Exception):
16
15
 
17
16
 
18
17
  # noinspection PyShadowingNames
19
- class Executables(object):
18
+ class Executables:
20
19
  """Class for finding executables on the host system.
21
20
  """
22
21
  def __init__(self):
@@ -80,7 +79,6 @@ class Executables(object):
80
79
  pip = get_executable('pip')
81
80
  cmd = pip + ' install wheel[signatures]'
82
81
  if win32:
83
- # self.ctx.run(cmd, echo=True)
84
82
  runners.run(cmd)
85
83
  exepath = get_executable(exename)
86
84
  # generate signing key if downloading wheel
@@ -97,7 +95,6 @@ class Executables(object):
97
95
  pip = get_executable('pip')
98
96
  cmd = pip + ' install twine'
99
97
  if win32:
100
- # self.ctx.run(cmd, echo=True)
101
98
  runners.run(cmd)
102
99
  exepath = get_executable(exename)
103
100
  else:
@@ -123,7 +120,6 @@ class Executables(object):
123
120
  npminstall = "npm install -g browserify --no-color"
124
121
  if not exepath:
125
122
  if win32:
126
- # self.ctx.run(npminstall, echo=False, encoding="utf-8")
127
123
  self.ctx.run(npminstall, echo=True, encoding="utf-8")
128
124
  exepath = get_executable(exename)
129
125
  else:
@@ -154,18 +150,6 @@ class Executables(object):
154
150
  raise MissingCommand("Missing babel (%s)" % npminstall)
155
151
  return exepath
156
152
 
157
- # def find_babel(self):
158
- # exename = 'babel'
159
- # exepath = get_executable(exename)
160
- # npminstall = "npm install -g babel --no-color"
161
- # if not exepath:
162
- # if win32:
163
- # self.ctx.run(npminstall, echo=False, encoding="utf-8")
164
- # exepath = get_executable(exename)
165
- # else:
166
- # raise MissingCommand("Missing babel (%s)" % npminstall)
167
- # return exepath
168
-
169
153
  def find_nodejs(self): # pragma: nocover
170
154
  """Find :program:`node`.
171
155
  """
@@ -213,9 +197,4 @@ def requires(*deps):
213
197
  except MissingCommand as e:
214
198
  warnings.warn(str(e))
215
199
  return fn
216
- # @wraps(fn)
217
- # def _inner(*args, **kwargs):
218
- # exe.require(*deps)
219
- # return fn(*args, **kwargs)
220
- # return _inner
221
200
  return _wrapper
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  from dktasklib.wintask import task
4
2
 
5
3
 
@@ -3,7 +3,6 @@ import textwrap
3
3
 
4
4
  from dktasklib.wintask import task
5
5
  from invoke import Collection
6
- # from dkfileutils.path import Path
7
6
  from dktasklib import runners
8
7
  from dktasklib.commands import Command
9
8
  from dktasklib.executables import requires
@@ -64,24 +63,6 @@ def ensure_node_modules(ctx):
64
63
  return True
65
64
 
66
65
 
67
- # def ensure_babel(ctx):
68
- # if 'babel' not in runners.run("npm ls -g --depth=0 babel --no-color"):
69
- # print("didn't find babel, installing it..")
70
- # with cd(ctx.pkg.root):
71
- # ctx.run("npm install -g babel")
72
- # else:
73
- # return True
74
-
75
-
76
- # def ensure_browserify(ctx):
77
- # if 'browserify' not in runners.run("npm ls -g --depth=0 browserify --no-color"):
78
- # print("didn't find browserify, installing it..")
79
- # with cd(ctx.pkg.root):
80
- # ctx.run("npm install -g browserify")
81
- # else:
82
- # return True
83
-
84
-
85
66
  def ensure_es2015(ctx):
86
67
  if 'babel-preset-es2015' not in runners.run("npm ls --depth=0 babel-preset-es2015 --no-color"):
87
68
  print("didn't find babel-preset-es2015, installing it..")
@@ -146,43 +127,6 @@ def ensure_babel_minify(ctx):
146
127
  return True
147
128
 
148
129
 
149
- # FIXME: cannot use @requires this way since it causes download/install of
150
- # requirements when this file is imported (not when the function is used!)
151
-
152
- # @requires('nodejs', 'npm', 'babel')
153
- # @task
154
- # def babel(ctx, source, dest=None, source_maps=True, force=False):
155
- # """
156
- # --source-maps --out-file $ProjectFileDir$/$ProjectName$/static/$ProjectName$/$FileNameWithoutExtension$.js $FilePath$
157
- # """
158
- # source = Path(source.format(pkg=ctx.pkg))
159
- # if dest is None:
160
- # dest = ctx.pkg.django_static / ctx.pkg.name / 'js'
161
- # dest.makedirs()
162
- # else:
163
- # dest = Path(dest.format(pkg=ctx.pkg))
164
- # if dest.isdir():
165
- # dest = dest / switch_extension(source.basename(), '.js')
166
-
167
- # if not force and dest_is_newer_than_source(source, dest):
168
- # print('babel:', dest, 'is up-to-date.')
169
- # return dest
170
-
171
- # ensure_package_json(ctx)
172
- # ensure_node_modules(ctx)
173
- # # ensure_babel(ctx)
174
- # # ensure_es2015(ctx)
175
- # ensure_preset_latest(ctx)
176
- # ensure_babelrc(ctx)
177
-
178
- # options = ""
179
- # if source_maps:
180
- # options += " --source-maps"
181
-
182
- # ctx.run("babel {options} --out-file {dest} {source}".format(**locals()))
183
- # return dest
184
-
185
-
186
130
  def version_js(ctx, fname, kind='pkg', force=False):
187
131
  """Add version number to a .js file.
188
132
  """
@@ -222,9 +166,7 @@ def browserify(ctx,
222
166
  """
223
167
  print('ensure package.json:', ensure_package_json(ctx))
224
168
  print('ensure node_modules:', ensure_node_modules(ctx))
225
- # print('ensure browserify:', ensure_browserify(ctx))
226
169
 
227
- # options = "--debug" # source maps
228
170
  options = "" # no source maps
229
171
  if babelify:
230
172
  print('ensure babelify:', ensure_babelify(ctx))
@@ -321,8 +263,6 @@ def babel_minify(ctx, src, dst):
321
263
  For example,
322
264
  minify index.js --mangle.keepClassName --deadcode.keepFnArgs --outFile index.min.js
323
265
  """
324
- # if os.path.exists(dst):
325
- # os.unlink(dst)
326
266
 
327
267
  babel_minifycmd(
328
268
  ctx,
@@ -339,24 +279,6 @@ def babel_minify(ctx, src, dst):
339
279
  return dst
340
280
 
341
281
 
342
- # @task(default=True)
343
- # def buildjs(ctx, src, dst, force=False, **kw):
344
- # uglify = kw.pop('uglify', False)
345
- # if kw.pop('browserify', False):
346
- # dst = browserify(ctx, src, dst,
347
- # babelify=kw.pop('babelify', src.endswith('.jsx')), **kw)
348
- # else:
349
- # dst = babel(ctx, src, dst, force=force)
350
-
351
- # if uglify:
352
- # finaldst = switch_extension(dst, '.min.js')
353
- # dst = uglifyjs(ctx, dst, finaldst)
354
- # if force:
355
- # dst = copy_to_version(ctx, dst, force=force)
356
-
357
- # return dst
358
-
359
-
360
282
  uglifycmd = Command('uglifyjs', '{src} {opts} -o {dst}',
361
283
  requirements=('nodejs', 'npm', 'uglify'))
362
284
 
@@ -382,9 +304,6 @@ def buildjs(ctx, src, dst, force=False, **kw):
382
304
  if kw.pop('browserify', False):
383
305
  dst = browserify(ctx, src, dst,
384
306
  babelify=kw.pop('babelify', src.endswith('.jsx')), **kw)
385
- else:
386
- # dst = babel(ctx, src, dst, force=force)
387
- pass
388
307
 
389
308
  if uglify:
390
309
  finaldst = switch_extension(dst, '.min.js')
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- from __future__ import print_function
3
1
  import os
4
2
  from dktasklib.wintask import task
5
3
  from .rule import BuildRule
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- from __future__ import print_function
3
1
  import sys
4
2
  import os
5
3
 
@@ -26,12 +24,6 @@ def manage(ctx, cmd, settings=None, manage_path=None, venv=None):
26
24
  manage_path = Path(pfind(settings_dir, 'manage.py')).dirname()
27
25
 
28
26
  with cd(manage_path):
29
- # print "MANAGE_PATH:", manage_path
30
- # print "CWD:", os.getcwd()
31
- # run('python -c "import sys;print sys.path"')
32
- # run('vex dev python -c "import sys;print chr(10).join(sys.path)"')
33
- # run("python -c \"import sys;print '\n'.join(sys.path)\"")
34
-
35
27
  call = "python manage.py {cmd}"
36
28
  if venv:
37
29
  call = "vex {venv} python manage.py {cmd} --traceback"
@@ -56,7 +48,6 @@ def collectstatic(ctx, settings=None, venv=None, clobber=False, force=False):
56
48
  for fname in ctx.pkg.django_static.glob(r'**/*\d+.min.*'):
57
49
  pubname = static / fname.relpath(ctx.pkg.django_static)
58
50
  if pubname.exists():
59
- # print 'checking:', pubname
60
51
  if pubname.open('rb').read() != fname.open('rb').read():
61
52
  changed_versioned_resources = True
62
53
  print()
@@ -0,0 +1,19 @@
1
+ import subprocess
2
+
3
+ from dktasklib.executables import exe
4
+
5
+
6
+ def npm(cmdline):
7
+ npm_exe = exe.find('npm', requires=['nodejs']) # noqa
8
+ return subprocess.check_output("npm " + cmdline, shell=True).decode('u8')
9
+
10
+
11
+ def global_package(pkgname):
12
+ """Check if an npm package is installed globally.
13
+ """
14
+ try:
15
+ # this is the 'correct' way, but it's increadably slow (4+ secs)
16
+ npm('ls -g --depth 0 ' + pkgname)
17
+ return True
18
+ except subprocess.CalledProcessError:
19
+ return False
@@ -0,0 +1,31 @@
1
+ from dktasklib.wintask import task
2
+ from .package_interface import Package
3
+ from ..utils import format_table, Column
4
+
5
+
6
+ @task
7
+ def package(ctx):
8
+ """Print detected package directories.
9
+ """
10
+ pkg = ctx.pkg if hasattr(ctx, 'pkg') else Package()
11
+
12
+ def row(attribute, value, description=''):
13
+ return dict(attribute=attribute, value=value, description=description)
14
+
15
+ print("The dk-tasklib Package object thinks your code has the following layout:")
16
+
17
+ print(format_table(
18
+ [
19
+ row('package_name', pkg.package_name, '(repo/pip-installable name)'),
20
+ row('name', pkg.name, '(importable name)'),
21
+ row('root', pkg.root, '(wc)'),
22
+ row('source', pkg.source, '(source directory)'),
23
+ row('source_js', pkg.source_js, '(js source directory)'),
24
+ row('source_less', pkg.source_less, '(less source directory)'),
25
+ row('docs', pkg.docs, '(docs directory)'),
26
+ row('django?', 'yes' if pkg.is_django() else 'no', '(django?)'),
27
+ ],
28
+ Column(field='attribute'),
29
+ Column(field='value'),
30
+ Column(field='description'),
31
+ ))