Skip to content

Commit

Permalink
Add node-sass
Browse files Browse the repository at this point in the history
  • Loading branch information
dozymoe committed Jun 8, 2019
1 parent d8e6868 commit cea4511
Show file tree
Hide file tree
Showing 44 changed files with 387 additions and 121 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

*.pyc
/*.egg-info/
/.eggs/
/build/
/dist/
/.virtualenv/
/requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "fireh_runner"]
path = fireh_runner
[submodule "lib/fireh_runner"]
path = lib/fireh_runner
url = https://github.com/dozymoe/fireh_runner
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
include pybuildtool/README.rst pybuildtool/wscript.example
exclude run
exclude wscript*
exclude requirements-*
exclude build-*
exclude .git*
exclude MANIFEST.in
prune etc
prune lib
16 changes: 8 additions & 8 deletions etc/runner.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"default_project": "pybuildtool",
"default_variant": "development",

"python_version": "3.5",
"python_version": "3.6",
"virtualenv_dir": ".virtualenv",
"waf_version": "1.9.9",
"waf_version": "2.0.17",

"modules": [
"fireh_runner.modules.setup",
"fireh_runner.modules.pip",
"fireh_runner.modules.python",
"fireh_runner.modules.waf"
"lib.fireh_runner.modules.setup",
"lib.fireh_runner.modules.pip",
"lib.fireh_runner.modules.python",
"lib.fireh_runner.modules.waf"
],
"setup_modules": [
"fireh_runner.setup_modules.python",
"fireh_runner.setup_modules.pybuildtool"
"lib.fireh_runner.setup_modules.python",
"lib.fireh_runner.setup_modules.pybuildtool"
],

"configuration": {
Expand Down
1 change: 0 additions & 1 deletion fireh_runner
Submodule fireh_runner deleted from a4f297
Empty file added lib/__init__.py
Empty file.
1 change: 1 addition & 0 deletions lib/fireh_runner
Submodule fireh_runner added at 1ace5c
2 changes: 0 additions & 2 deletions pybuildtool/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ Several things to keep in mind:
Warning
-------

Apparently doesn't work with waf version 2, the build order is a mess.

``waf`` does not like it if the source and target existed in the same directory,
see: `Files are always built`_.

Expand Down
4 changes: 2 additions & 2 deletions pybuildtool/addons/watch/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from subprocess import call
import sys
from time import sleep
from yaml import load as yaml_load
import yaml

from .file_observer import FileObserver

Expand Down Expand Up @@ -68,7 +68,7 @@ def do_reload(self):
self.observer.close()

with open(self.config_file, 'r') as f:
config = yaml_load(f)
config = yaml.load(f, Loader=yaml.SafeLoader)

self.observer.open(list(os.path.realpath(f) for f in\
get_source_files(config, self.bld)))
Expand Down
2 changes: 1 addition & 1 deletion pybuildtool/core/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .rule import Rule
from ..misc.collections_utils import data_merge

class Group(object):
class Group():

name = None
conf = None
Expand Down
6 changes: 3 additions & 3 deletions pybuildtool/core/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def token_to_filename(token_name, bld):
token_name.replace('/', '__'))


class Rule(object):
class Rule():

def __init__(self, group, config, file_in, file_out, depend_in, extra_out):
self.conf = config or {}
Expand Down Expand Up @@ -109,8 +109,8 @@ def files(self):
def rules(self):
result = []

if len(self.extra_out) and (len(self.file_out) > 1 or\
(len(self.file_out) and self.file_out[0].endswith(
if self.extra_out and (len(self.file_out) > 1 or\
(self.file_out and self.file_out[0].endswith(
os.path.sep))):

self.bld.fatal('Cannot use extra_out with multiple file_out')
Expand Down
8 changes: 4 additions & 4 deletions pybuildtool/core/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def add_list_args_join(self, separator, *options, **kwargs):

for option in options:
values = make_list(self.conf.get(option))
if len(values) == 0:
if not values:
continue

option = '--' + option.replace('_', '-')
Expand All @@ -172,7 +172,7 @@ def add_list_args_multi(self, *options, **kwargs):

for option in options:
values = make_list(self.conf.get(option))
if len(values) == 0:
if not values:
continue

option = '--' + option.replace('_', '-')
Expand Down Expand Up @@ -200,7 +200,7 @@ def add_path_list_args_join(self, separator, *options, **kwargs):

for option in options:
values = make_list(self.conf.get(option))
if len(values) == 0:
if not values:
continue

option = '--' + option.replace('_', '-')
Expand All @@ -215,7 +215,7 @@ def add_path_list_args_multi(self, *options, **kwargs):

for option in options:
values = make_list(self.conf.get(option))
if len(values) == 0:
if not values:
continue

option = '--' + option.replace('_', '-')
Expand Down
14 changes: 6 additions & 8 deletions pybuildtool/misc/collections_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ def data_merge(a, b):
#if a is None or isinstance(a, str) or isinstance(a, unicode) or
#isinstance(a, int) or isinstance(a, long) or isinstance(a, float):

if a is None or isinstance(a, str) or isinstance(a, int) or\
isinstance(a, float):

if a is None or isinstance(a, (str, int, float)):
# border case for first run or if a is a primitive
a = b
elif isinstance(a, list):
Expand Down Expand Up @@ -55,7 +53,7 @@ def is_non_string_iterable(data):
"""Check if data was iterable but not a string."""
# http://stackoverflow.com/a/17222092
try:
if isinstance(data, unicode) or isinstance(data, str):
if isinstance(data, (unicode, str)):
return False
except NameError:
pass
Expand All @@ -76,9 +74,9 @@ def make_list(items, nodict=False):
"""If items was not a list, create a list with it as a member."""
if items is None:
return []
elif not is_non_string_iterable(items):
if not is_non_string_iterable(items):
return [items]
elif nodict and isinstance(items, dict):
if nodict and isinstance(items, dict):
return [items]
else:
return items

return items
7 changes: 3 additions & 4 deletions pybuildtool/misc/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def expand_resource(group, path):
node = bld.path.find_resource(path)
if node:
return node.abspath()
return None


def expand_wildcard(group, path):
Expand All @@ -34,11 +35,9 @@ def expand_wildcard(group, path):
if os.path.isabs(path):
return [node.abspath() for node in\
bld.root.ant_glob(path.lstrip('/'))]
return [node.abspath() for node in bld.path.ant_glob(path)]

else:
return [node.abspath() for node in bld.path.ant_glob(path)]

elif os.path.isabs(path):
if os.path.isabs(path):
if path.endswith(os.path.sep):
node = bld.root.find_dir(path.lstrip('/'))
else:
Expand Down
15 changes: 15 additions & 0 deletions pybuildtool/misc/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
try:
from importlib.machinery import SourceFileLoader
from importlib.util import module_from_spec, spec_from_loader
except ImportError:
import imp


def load_module_from_filename(filename, name):
try:
spec = spec_from_loader(name, SourceFileLoader(name, filename))
mod = module_from_spec(spec)
spec.loader.exec_module(mod)
except NameError:
mod = imp.load_source(name, filename)
return mod
4 changes: 2 additions & 2 deletions pybuildtool/misc/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def parse_group(group_name, config, level, parent_group):
print((parent_group.get_name(), group_name, dict(config),
level))

bld.fatal('rule "%s" not found in: %s' % (rule_in, ', '.join(
bld._token_names.keys())))
bld.fatal('rule "%s" not found in: %s' % (rule_in,
', '.join(bld._token_names.keys())))

g(file_in=file_in, file_out=file_out, depend_in=depend_in,
extra_out=extra_out)
Expand Down
20 changes: 7 additions & 13 deletions pybuildtool/tools/ansibleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
import os
import sys
import six
from waflib import Logs # pylint:disable=import-error
from yaml import safe_load as yaml_load
from pybuildtool import BaseTask, expand_resource, make_list
from pybuildtool.misc.python import load_module_from_filename
from waflib import Logs # pylint:disable=import-error

tool_name = __name__

Expand Down Expand Up @@ -123,14 +124,8 @@ def prepare(self):
sys.path.append(dirname)
mod = __import__(filebase)
else:
try:
from importlib.machinery import SourceFileLoader
mod = SourceFileLoader('context_python',
python_file).load_module()
except ImportError:
import imp
mod = imp.load_source('context_python', python_file)
python_export = mod.export
mod = load_module_from_filename(python_file, filebase)
python_export = mod.export
self.context.update(python_export)

self.context.update(self.conf.get('context', {}))
Expand Down Expand Up @@ -180,7 +175,7 @@ def extract_errors(result):

success = True
changed = False
if len(self.items):
if self.items:
args = dict(self.args)
kwargs = args['complex_args']
for item in self.items:
Expand Down Expand Up @@ -211,13 +206,12 @@ def extract_errors(result):

if success:
return 0
else:
return 1
return 1


def configure(conf):
conf.start_msg("Checking for python module '%s'" % tool_name)
try:
import ansible # pylint: disable=unused-variable
import ansible # pylint: disable=unused-import
except ImportError:
conf.end_msg('not found', color='YELLOW')
6 changes: 3 additions & 3 deletions pybuildtool/tools/cppcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def prepare(self):

# Enable additional checks
c = make_list(cfg.get('enable_check'))
if len(c):
if c:
args.append('--enable=' + ','.join(c))

# Exit code suppressions
Expand Down Expand Up @@ -287,7 +287,7 @@ def prepare(self):

# Relative paths
c = make_list(cfg.get('relative_paths'))
if len(c):
if c:
args.append('--relative-paths=' + ';'.join(c))

# Rule
Expand Down Expand Up @@ -336,7 +336,7 @@ def prepare(self):


def perform(self):
if len(self.file_out) != 0:
if self.file_out:
self.bld.fatal('%s produces no output' % tool_name.capitalize())

kwargs = {}
Expand Down
2 changes: 1 addition & 1 deletion pybuildtool/tools/dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def prepare(self):


def perform(self):
if len(self.file_in) == 0:
if not self.file_in:
self.bld.fatal('%s needs input' % tool_name)
if len(self.file_out) != 1:
self.bld.fatal('%s produces one output' % tool_name)
Expand Down
4 changes: 2 additions & 2 deletions pybuildtool/tools/doxygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def prepare(self):


def perform(self):
if len(self.file_in) != 0:
if self.file_in:
self.bld.fatal('%s takes no input' % tool_name.capitalize())
if len(self.file_out) != 0:
if self.file_out:
self.bld.fatal('%s produces no output' % tool_name.capitalize())

kwargs = {}
Expand Down
4 changes: 2 additions & 2 deletions pybuildtool/tools/flatbuffers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def prepare(self):


def perform(self):
if len(self.file_in) == 0:
if not self.file_in:
self.bld.fatal('%s needs input' % tool_name.capitalize())
if len(self.file_out) != 0:
if self.file_out:
self.bld.fatal('%s produces no output' % tool_name.capitalize())

executable = self.env['%s_BIN' % tool_name.upper()]
Expand Down
4 changes: 2 additions & 2 deletions pybuildtool/tools/html-linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def prepare(self):
args = self.args

c = make_list(cfg.get('disable'))
if len(c):
if c:
invalid_disable_items = set(c) - self.DISABLE_LIST
if len(invalid_disable_items):
if invalid_disable_items:
self.bld.fatal('invalid disable configuration items: ' +\
', '.join(invalid_disable_items))
args.append('--disable=' + ','.join(c))
Expand Down
11 changes: 3 additions & 8 deletions pybuildtool/tools/jinja2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import sys
from yaml import safe_load as yaml_load
from pybuildtool import BaseTask, expand_resource, is_non_string_iterable
from pybuildtool.misc.python import load_module_from_filename

tool_name = __name__

Expand Down Expand Up @@ -75,14 +76,8 @@ def prepare(self):
sys.path.append(dirname)
mod = __import__(filebase)
else:
try:
from importlib.machinery import SourceFileLoader
mod = SourceFileLoader('context_python',
python_file).load_module()
except ImportError:
import imp
mod = imp.load_source('context_python', python_file)
python_export = mod.export
mod = load_module_from_filename(python_file, filebase)
python_export = mod.export
self.context.update(python_export)

self.context.update(cfg.get('context', {}))
Expand Down
Loading

0 comments on commit cea4511

Please sign in to comment.