package init
This commit is contained in:
parent
c8f30ec38e
commit
27bda2090a
31
erlang-erlydtl-0001-Verbose-testing.patch
Normal file
31
erlang-erlydtl-0001-Verbose-testing.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 19 May 2016 18:55:10 +0300
|
||||
Subject: [PATCH] Verbose testing
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/rebar-tests.config b/rebar-tests.config
|
||||
index 199ac85..d2440ff 100644
|
||||
--- a/rebar-tests.config
|
||||
+++ b/rebar-tests.config
|
||||
@@ -1,20 +1,5 @@
|
||||
%% -*- mode: erlang -*-
|
||||
|
||||
-{eunit_opts,
|
||||
- [%% This turns off the default output, MUST HAVE
|
||||
- no_tty,
|
||||
- %% Uses the progress formatter with ANSI-colored output
|
||||
- {report, {eunit_progress, [colored
|
||||
- %% uncomment to get a list of slowest running tests
|
||||
- %%, profile
|
||||
- ]}}
|
||||
- ]}.
|
||||
-
|
||||
-{deps,
|
||||
- [{eunit_formatters, ".*",
|
||||
- {git, "git://github.com/seancribbs/eunit_formatters", "35e3e6ab2db48af776a1a21bba6f1461c97caacb"}}
|
||||
- ]}.
|
||||
-
|
||||
{pre_hooks,
|
||||
[{eunit,
|
||||
"erlc -I include/erlydtl_preparser.hrl -o test"
|
||||
@ -0,0 +1,34 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 19 May 2016 19:08:13 +0300
|
||||
Subject: [PATCH] No such function exported gettext_compile:write_pretty/1
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/src/i18n/po_generator.erl b/src/i18n/po_generator.erl
|
||||
index 99f0f6e..0fa61f5 100644
|
||||
--- a/src/i18n/po_generator.erl
|
||||
+++ b/src/i18n/po_generator.erl
|
||||
@@ -37,9 +37,9 @@ write_entries(Items)->
|
||||
Fi = gettext_compile:fmt_fileinfo(Finfo),
|
||||
io:format(Fd, "~n#: ~s~n", [Fi]),
|
||||
ok = file:write(Fd, "msgid \"\"\n"),
|
||||
- gettext_compile:write_pretty(Id),
|
||||
+ gettext_compile:write_pretty(Id, Fd),
|
||||
ok = file:write(Fd, "msgstr \"\"\n"),
|
||||
- gettext_compile:write_pretty(Translation)
|
||||
+ gettext_compile:write_pretty(Translation, Fd)
|
||||
end,
|
||||
lists:foreach(F, Items).
|
||||
|
||||
@@ -49,9 +49,9 @@ write_fuzzy_entries(Items) ->
|
||||
F = fun({Id,Translation,_}) ->
|
||||
ok = file:write(Fd, "#, fuzzy\n"),
|
||||
ok = file:write(Fd, "msgid \"\"\n"),
|
||||
- gettext_compile:write_pretty(Id),
|
||||
+ gettext_compile:write_pretty(Id, Fd),
|
||||
ok = file:write(Fd, "msgstr \"\"\n"),
|
||||
- gettext_compile:write_pretty(Translation),
|
||||
+ gettext_compile:write_pretty(Translation, Fd),
|
||||
ok = file:write(Fd, "\n")
|
||||
end,
|
||||
lists:foreach(F, Items).
|
||||
@ -0,0 +1,19 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 19 May 2016 19:10:47 +0300
|
||||
Subject: [PATCH] No such function exported gettext_compile:fmt_fileinfo/1
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/src/i18n/po_generator.erl b/src/i18n/po_generator.erl
|
||||
index 0fa61f5..fa7b3fb 100644
|
||||
--- a/src/i18n/po_generator.erl
|
||||
+++ b/src/i18n/po_generator.erl
|
||||
@@ -34,8 +34,6 @@ generate_file(Lang,Items, Fuzzy) ->
|
||||
write_entries(Items)->
|
||||
Fd = get(fd),
|
||||
F = fun({Id,Translation,Finfo}) ->
|
||||
- Fi = gettext_compile:fmt_fileinfo(Finfo),
|
||||
- io:format(Fd, "~n#: ~s~n", [Fi]),
|
||||
ok = file:write(Fd, "msgid \"\"\n"),
|
||||
gettext_compile:write_pretty(Id, Fd),
|
||||
ok = file:write(Fd, "msgstr \"\"\n"),
|
||||
@ -0,0 +1,29 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 19 May 2016 19:14:25 +0300
|
||||
Subject: [PATCH] No such fun - gettext_compile:open_po_file/3
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/src/i18n/po_generator.erl b/src/i18n/po_generator.erl
|
||||
index fa7b3fb..0b2da0a 100644
|
||||
--- a/src/i18n/po_generator.erl
|
||||
+++ b/src/i18n/po_generator.erl
|
||||
@@ -15,11 +15,17 @@
|
||||
%%
|
||||
%% API Functions
|
||||
%%
|
||||
+-define(LANG_DIR, "lang").
|
||||
+-define(POFILE, "gettext.po").
|
||||
generate_file(Lang,Items, Fuzzy) ->
|
||||
Gettext_App_Name = "tmp",
|
||||
GtxtDir = ".",
|
||||
io:format("Opening po file"),
|
||||
- gettext_compile:open_po_file(Gettext_App_Name, GtxtDir, Lang),
|
||||
+ DefDir = filename:join([GtxtDir, ?LANG_DIR, Gettext_App_Name, Lang]),
|
||||
+ Fname = filename:join([DefDir, ?POFILE]),
|
||||
+ filelib:ensure_dir(Fname),
|
||||
+ {ok,Fd} = file:open(Fname, [write]),
|
||||
+ put(fd,Fd),
|
||||
|
||||
gettext_compile:write_header(),
|
||||
io:format("Writing entries~n"),
|
||||
@ -0,0 +1,19 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 19 May 2016 19:14:55 +0300
|
||||
Subject: [PATCH] No such fun - gettext_compile:close_file/0
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/src/i18n/po_generator.erl b/src/i18n/po_generator.erl
|
||||
index 0b2da0a..68640a1 100644
|
||||
--- a/src/i18n/po_generator.erl
|
||||
+++ b/src/i18n/po_generator.erl
|
||||
@@ -32,7 +32,7 @@ generate_file(Lang,Items, Fuzzy) ->
|
||||
write_entries(Items),
|
||||
io:format("Writing fuzzy entries~n"),
|
||||
write_fuzzy_entries(Fuzzy),
|
||||
- gettext_compile:close_file().
|
||||
+ file:close(get(fd)).
|
||||
|
||||
%%
|
||||
%% Local Functions
|
||||
31
erlang-erlydtl-0006-Support-Erlang-OTP-20.0.patch
Normal file
31
erlang-erlydtl-0006-Support-Erlang-OTP-20.0.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From: Dmitry Klionsky <dm.klionsky@gmail.com>
|
||||
Date: Tue, 27 Jun 2017 17:41:18 +0300
|
||||
Subject: [PATCH] Support Erlang/OTP 20.0
|
||||
|
||||
|
||||
diff --git a/.travis.yml b/.travis.yml
|
||||
index d1e5019..d50acb2 100644
|
||||
--- a/.travis.yml
|
||||
+++ b/.travis.yml
|
||||
@@ -2,6 +2,8 @@ language: erlang
|
||||
sudo: false
|
||||
otp_release:
|
||||
# Test on all supported releases accepted by the `require_otp_vsn` in rebar.config
|
||||
+ - 20.0
|
||||
+ - 19.3
|
||||
- 18.0
|
||||
- 17.4
|
||||
- 17.3
|
||||
diff --git a/rebar.config b/rebar.config
|
||||
index 3ac7c11..4680515 100644
|
||||
--- a/rebar.config
|
||||
+++ b/rebar.config
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
%% accept R15B02.., any R16B except R16B03
|
||||
%% also accept OTP v17, altough it may not work properly on that release yet..
|
||||
-{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18|19"}.
|
||||
+{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18|19|20"}.
|
||||
|
||||
{erl_opts, [debug_info]}.
|
||||
{yrl_opts, [{includefile, "include/erlydtl_preparser.hrl"}]}.
|
||||
58
erlang-erlydtl-0007-compatibility-with-OTP-21.patch
Normal file
58
erlang-erlydtl-0007-compatibility-with-OTP-21.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From: brigadier <eugeneim@gmail.com>
|
||||
Date: Fri, 17 Aug 2018 00:38:56 +0300
|
||||
Subject: [PATCH] compatibility with OTP 21
|
||||
|
||||
|
||||
diff --git a/rebar.config b/rebar.config
|
||||
index 4680515..8712dfa 100644
|
||||
--- a/rebar.config
|
||||
+++ b/rebar.config
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
%% accept R15B02.., any R16B except R16B03
|
||||
%% also accept OTP v17, altough it may not work properly on that release yet..
|
||||
-{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18|19|20"}.
|
||||
+{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18|19|20|21"}.
|
||||
|
||||
{erl_opts, [debug_info]}.
|
||||
{yrl_opts, [{includefile, "include/erlydtl_preparser.hrl"}]}.
|
||||
diff --git a/src/erlydtl_filters.erl b/src/erlydtl_filters.erl
|
||||
index 3fe1be3..43eeae8 100644
|
||||
--- a/src/erlydtl_filters.erl
|
||||
+++ b/src/erlydtl_filters.erl
|
||||
@@ -355,10 +355,10 @@ floatformat(_, _) -> "".
|
||||
floatformat_io(Number, []) ->
|
||||
floatformat_io(Number, -1);
|
||||
floatformat_io(Number, 0) ->
|
||||
- hd(io_lib:format("~B", [erlang:round(Number)]));
|
||||
+ lists:flatten(io_lib:format("~B", [erlang:round(Number)]));
|
||||
floatformat_io(Number, Precision) when Precision > 0 ->
|
||||
- hd(io_lib:format("~.*f",[Precision, Number]));
|
||||
-floatformat_io(Number, Precision) when Precision < 0 ->
|
||||
+ lists:flatten(io_lib:format("~.*f",[Precision, Number]));
|
||||
+floatformat_io(Number, Precision) when Precision < 0 ->
|
||||
Round = erlang:round(Number),
|
||||
RoundPrecision = round(Number, -Precision),
|
||||
if RoundPrecision == Round ->
|
||||
@@ -590,11 +590,12 @@ stringformat(Input, Conversion) when is_binary(Conversion) ->
|
||||
stringformat(Input, unicode:characters_to_list(Conversion));
|
||||
stringformat(Input, Conversion) ->
|
||||
ParsedConversion = re:replace(Conversion, "([\-#\+ ]?)([0-9\*]+)?(\.?)([0-9]?)([diouxXeEfFgGcrs])", "\\1 ,\\2 ,\\3 ,\\4 ,\\5 ", [{return,list}]),
|
||||
+
|
||||
?debugFmt("ParsedConversion: ~p~n", [ParsedConversion]),
|
||||
ParsedConversion1 = lists:map(fun(X) -> string:strip(X) end, string:tokens(ParsedConversion, ",")),
|
||||
[ConversionFlag, MinFieldWidth, Precision, PrecisionLength, ConversionType] = ParsedConversion1,
|
||||
?debugFmt("ConversionFlag, MinFieldWidth, Precision, PrecisionLength, ConversionType: ~p, ~p, ~p, ~p, ~p ~n", [ConversionFlag, cast_to_integer(MinFieldWidth), Precision, cast_to_integer(PrecisionLength), ConversionType]),
|
||||
- [String] = stringformat_io(Input, Conversion, ConversionFlag, cast_to_integer(MinFieldWidth), Precision, cast_to_integer(PrecisionLength), ConversionType),
|
||||
+ String = stringformat_io(Input, Conversion, ConversionFlag, cast_to_integer(MinFieldWidth), Precision, cast_to_integer(PrecisionLength), ConversionType),
|
||||
lists:flatten(String).
|
||||
|
||||
%% @doc
|
||||
@@ -640,6 +641,7 @@ stringformat_io(Input, Conversion, _ConversionFlag, _MinFieldWidth,
|
||||
io_lib:format(Format, [cast_to_float(Input)]);
|
||||
stringformat_io(Input, Conversion, _ConversionFlag, _MinFieldWidth,
|
||||
[], [], "d")->
|
||||
+
|
||||
%?debugMsg("plain d"),
|
||||
%Conversion = [ConversionFlag, MinFieldWidth, Precision, PrecisionLength, ConversionType],
|
||||
Format = "~" ++ re:replace(Conversion, "d", "B", [{return, list}] ),
|
||||
42
erlang-erlydtl-0008-merl-bug-in-OTP-21-workaround.patch
Normal file
42
erlang-erlydtl-0008-merl-bug-in-OTP-21-workaround.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From: brigadier <eugeneim@gmail.com>
|
||||
Date: Sat, 18 Aug 2018 18:55:19 +0300
|
||||
Subject: [PATCH] merl bug in OTP 21 workaround
|
||||
|
||||
|
||||
diff --git a/src/erlydtl_beam_compiler.erl b/src/erlydtl_beam_compiler.erl
|
||||
index 7ab3aa8..c7b149a 100644
|
||||
--- a/src/erlydtl_beam_compiler.erl
|
||||
+++ b/src/erlydtl_beam_compiler.erl
|
||||
@@ -861,8 +861,9 @@ blocktrans_ast(Args, Contents, PluralContents, TreeWalker) ->
|
||||
Body ->
|
||||
{ok, DjangoParseTree} = do_parse_template(Body, TreeWalkerAcc#treewalker.context),
|
||||
{{BodyAst, BodyInfo}, BodyTreeWalker} = body_ast(DjangoParseTree, TreeWalkerAcc),
|
||||
+ Clause = erl_syntax:clause([erl_syntax:abstract(Locale)], none, [BodyAst]),
|
||||
{merge_info(BodyInfo, AstInfoAcc), BodyTreeWalker,
|
||||
- [?Q("_@Locale@ -> _@BodyAst")|ClauseAcc]}
|
||||
+ [Clause | ClauseAcc]}
|
||||
end
|
||||
end,
|
||||
{MergedInfo, TreeWalker3, []}, TLocales),
|
||||
@@ -975,14 +976,15 @@ compiletime_trans_ast(TFun, Text, LContext,
|
||||
}=TreeWalker) ->
|
||||
ClAst = lists:foldl(
|
||||
fun(Locale, ClausesAcc) ->
|
||||
- [?Q("_@Locale@ -> _@translated",
|
||||
- [{translated, case TFun(Text, phrase_locale(Locale, LContext)) of
|
||||
- default -> string_ast(Text, Context);
|
||||
- Translated -> string_ast(Translated, Context)
|
||||
- end}])
|
||||
- |ClausesAcc]
|
||||
+ BodyAst = case TFun(Text, phrase_locale(Locale, LContext)) of
|
||||
+ default -> string_ast(Text, Context);
|
||||
+ Translated -> string_ast(Translated, Context)
|
||||
+ end,
|
||||
+ Clause = erl_syntax:clause([erl_syntax:abstract(Locale)], none, [BodyAst]),
|
||||
+ [Clause | ClausesAcc]
|
||||
end,
|
||||
[], TLocales),
|
||||
+
|
||||
{{?Q(["case _CurrentLocale of",
|
||||
" _@_ClAst -> _;",
|
||||
" _ -> _@string",
|
||||
@ -0,0 +1,18 @@
|
||||
From: Seb Maynard <seb@seb.so>
|
||||
Date: Thu, 24 Jan 2019 14:47:14 +0000
|
||||
Subject: [PATCH] Make sure that when checking if a function is exported that
|
||||
the module in question is loaded by the code server
|
||||
|
||||
|
||||
diff --git a/src/erlydtl_runtime.erl b/src/erlydtl_runtime.erl
|
||||
index fad5872..e7efcc8 100644
|
||||
--- a/src/erlydtl_runtime.erl
|
||||
+++ b/src/erlydtl_runtime.erl
|
||||
@@ -472,6 +472,7 @@ read_file(Module, Function, DocRoot, FileName, ReaderOptions) ->
|
||||
throw({read_file, AbsName, Reason})
|
||||
end.
|
||||
read_file_internal(Module, Function, FileName, ReaderOptions) ->
|
||||
+ _ = code:ensure_loaded(Module),
|
||||
case erlang:function_exported(Module, Function,1) of
|
||||
true ->
|
||||
Module:Function(FileName);
|
||||
19
erlang-erlydtl-0010-Support-Erlang-OTP-22.0.patch
Normal file
19
erlang-erlydtl-0010-Support-Erlang-OTP-22.0.patch
Normal file
@ -0,0 +1,19 @@
|
||||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Mon, 11 Nov 2019 00:03:59 +0100
|
||||
Subject: [PATCH] Support Erlang/OTP 22.0
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/rebar.config b/rebar.config
|
||||
index 8712dfa..ea35569 100644
|
||||
--- a/rebar.config
|
||||
+++ b/rebar.config
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
%% accept R15B02.., any R16B except R16B03
|
||||
%% also accept OTP v17, altough it may not work properly on that release yet..
|
||||
-{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18|19|20|21"}.
|
||||
+{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18|19|20|21|22"}.
|
||||
|
||||
{erl_opts, [debug_info]}.
|
||||
{yrl_opts, [{includefile, "include/erlydtl_preparser.hrl"}]}.
|
||||
50
erlang-erlydtl.spec
Normal file
50
erlang-erlydtl.spec
Normal file
@ -0,0 +1,50 @@
|
||||
%global realname erlydtl
|
||||
%global upstream erlydtl
|
||||
Name: erlang-%{realname}
|
||||
Version: 0.12.1
|
||||
Release: 1
|
||||
BuildArch: noarch
|
||||
Summary: Erlang implementation of the Django Template Language
|
||||
License: MIT
|
||||
URL: https://github.com/%{upstream}/%{realname}
|
||||
VCS: scm:git:https://github.com/%{upstream}/%{realname}.git
|
||||
Source0: https://github.com/%{upstream}/%{realname}/archive/%{version}/%{realname}-%{version}.tar.gz
|
||||
Patch1: erlang-erlydtl-0001-Verbose-testing.patch
|
||||
Patch2: erlang-erlydtl-0002-No-such-function-exported-gettext_compile-write_pret.patch
|
||||
Patch3: erlang-erlydtl-0003-No-such-function-exported-gettext_compile-fmt_filein.patch
|
||||
Patch4: erlang-erlydtl-0004-No-such-fun-gettext_compile-open_po_file-3.patch
|
||||
Patch5: erlang-erlydtl-0005-No-such-fun-gettext_compile-close_file-0.patch
|
||||
Patch6: erlang-erlydtl-0006-Support-Erlang-OTP-20.0.patch
|
||||
Patch7: erlang-erlydtl-0007-compatibility-with-OTP-21.patch
|
||||
Patch8: erlang-erlydtl-0008-merl-bug-in-OTP-21-workaround.patch
|
||||
Patch9: erlang-erlydtl-0009-Make-sure-that-when-checking-if-a-function-is-export.patch
|
||||
Patch10: erlang-erlydtl-0010-Support-Erlang-OTP-22.0.patch
|
||||
Provides: ErlyDTL = %{version}-%{release}
|
||||
BuildRequires: erlang-rebar
|
||||
%description
|
||||
ErlyDTL is an Erlang implementation of the Django Template Language. The
|
||||
erlydtl module compiles Django Template source code into Erlang bytecode. The
|
||||
compiled template has a "render" function that takes a list of variables and
|
||||
returns a fully rendered document.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n %{realname}-%{version}
|
||||
|
||||
%build
|
||||
%{erlang_compile}
|
||||
|
||||
%install
|
||||
%{erlang_install}
|
||||
cp -arv priv %{buildroot}/%{erlang_appdir}/
|
||||
|
||||
%check
|
||||
%{erlang_test -C rebar-tests.config}
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc CONTRIBUTING.md NEWS.md README.markdown README_I18N
|
||||
%{erlang_appdir}/
|
||||
|
||||
%changelog
|
||||
* Sat Aug 29 2020 wangyue <wangyue92@huawei.com> - 0.12.1-1
|
||||
- package init
|
||||
5
erlang-erlydtl.yaml
Normal file
5
erlang-erlydtl.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
git_url: https://github.com/erlydtl/erlydtl
|
||||
version_control: github
|
||||
src_repo: erlydtl/erlydtl
|
||||
tag_prefix: "^v"
|
||||
seperator: "."
|
||||
BIN
erlydtl-0.12.1.tar.gz
Normal file
BIN
erlydtl-0.12.1.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user