mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
Add conf/profile
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
24ba182fa1
commit
74a27f1c19
4 changed files with 23 additions and 8 deletions
4
conf/Makefile
Normal file
4
conf/Makefile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
TOPDIR = ..
|
||||
|
||||
include $(TOPDIR)/make/proj.mk
|
||||
include $(MODDIR)/make/dirs.mk
|
||||
4
conf/profile/Makefile
Normal file
4
conf/profile/Makefile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
TOPDIR = ../..
|
||||
|
||||
include $(TOPDIR)/make/proj.mk
|
||||
include $(MODDIR)/make/profile.mk
|
||||
|
|
@ -29,16 +29,15 @@ class TrimSourceCmd(jwutils.Cmd):
|
|||
for path in args.input:
|
||||
with open(path, 'r+') as infile:
|
||||
contents = infile.read()
|
||||
name = os.path.basename(path)
|
||||
ext = os.path.splitext(path)[1]
|
||||
|
||||
# TODO: support other types in this block
|
||||
mime = magic.detect_from_content(contents).mime_type
|
||||
if mime != 'text/plain':
|
||||
raise Exception("unsupported file type", mime, "of", path)
|
||||
name = os.path.basename(path)
|
||||
ext = os.path.splitext(path)[1]
|
||||
if name != 'Makefile' and ext != '.mk':
|
||||
raise Exception("unsupported file type of", path)
|
||||
mime = 'text/x-makefile'
|
||||
if mime in [ 'text/plain', 'application/x-empty' ]:
|
||||
if name != 'Makefile' and ext != '.mk':
|
||||
raise Exception("unsupported file type of", path)
|
||||
mime = 'text/x-makefile'
|
||||
|
||||
out = self._run(args, mime, path, contents)
|
||||
infile.seek(0)
|
||||
|
|
@ -55,6 +54,8 @@ class CmdBeautify(TrimSourceCmd):
|
|||
return p
|
||||
|
||||
def _processTextXMakefile(self, args, mime, path, contents):
|
||||
|
||||
# -- assignments
|
||||
r = ''
|
||||
indent = args.indent_assignments
|
||||
for line in contents.splitlines(True):
|
||||
|
|
@ -63,6 +64,12 @@ class CmdBeautify(TrimSourceCmd):
|
|||
r += line
|
||||
continue
|
||||
r += misc.pad(m.group(1), indent - len(m.group(2))) + m.group(2) + m.group(3) + ' ' + m.group(4) + '\n'
|
||||
|
||||
# -- trailing white space
|
||||
contents = r
|
||||
r = ''
|
||||
for line in contents.splitlines(False):
|
||||
r += line.rstrip() + '\n'
|
||||
return r
|
||||
|
||||
def _run(self, args, mime, path, contents):
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ TOPDIR = ../..
|
|||
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
INPUT = test.mk
|
||||
INPUT = test.mk
|
||||
EXE = $(TOPDIR)/scripts/trim-src.py
|
||||
EXE_ARGS = beautify $(INPUT)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue