Browse code

Added package Js2Py and its dependencies (pyjsparser and tzlocal, Bug 1953588)

Change-Id: Id89baaedc0346a67696c0292e6e97c5fe6f7f3a7
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3727
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

xiaolin-vmware authored on 2017/09/09 08:45:53
Showing 4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,92 @@
0
+diff --git a/js2py/internals/byte_trans.py b/js2py/internals/byte_trans.py
1
+index eb042fb..8842fdb 100644
2
+--- a/js2py/internals/byte_trans.py
3
+@@ -682,19 +682,19 @@ def main():
4
+     #
5
+     # }
6
+     a.emit(d)
7
+-    print a.declared_vars
8
+-    print a.exe.tape
9
+-    print len(a.exe.tape)
10
++    print(a.declared_vars)
11
++    print(a.exe.tape)
12
++    print(len(a.exe.tape))
13
+ 
14
+ 
15
+     a.exe.compile()
16
+ 
17
+     def log(this, args):
18
+-        print args[0]
19
++        print(args[0])
20
+         return 999
21
+ 
22
+ 
23
+-    print a.exe.run(a.exe.space.GlobalObj)
24
++    print(a.exe.run(a.exe.space.GlobalObj))
25
+ 
26
+ 
27
+ if __name__=='__main__':
28
+
29
+diff --git a/js2py/internals/speed.py b/js2py/internals/speed.py
30
+index 82f9e62..02c59a3 100644
31
+--- a/js2py/internals/speed.py
32
+@@ -47,7 +47,7 @@ t = []
33
+ 
34
+ Type = None
35
+ try:
36
+-    print timeit(
37
++    print(timeit(
38
+ """
39
+ 
40
+ t.append(4)
41
+@@ -55,6 +55,6 @@ t.pop()
42
+ 
43
+ 
44
+ 
45
+-""", "from __main__ import X,Y,namedtuple,array,t,add,Type, izip", number=1000000)
46
++""", "from __main__ import X,Y,namedtuple,array,t,add,Type, izip", number=1000000))
47
+ except:
48
+-    raise
49
+\ No newline at end of file
50
++    raise
51
+
52
+diff --git a/js2py/internals/opcodes.py b/js2py/internals/opcodes.py
53
+index 686bca1..184d39e 100644
54
+--- a/js2py/internals/opcodes.py
55
+@@ -650,7 +650,7 @@ class WITH(OP_CODE):
56
+ 
57
+         val, typ, spec = status
58
+         if typ!=3:
59
+-            print typ
60
++            print(typ)
61
+             ctx.stack.pop()
62
+ 
63
+         if typ == 0:  # normal
64
+
65
+diff --git a/js2py/internals/constructors/jsfunction.py b/js2py/internals/constructors/jsfunction.py
66
+index bfe631c..ef39b44 100644
67
+--- a/js2py/internals/constructors/jsfunction.py
68
+@@ -65,5 +65,5 @@ def _eval(this, args):
69
+     return executable_code(code_str, args.space, global_context=True)()
70
+ 
71
+ def log(this, args):
72
+-    print ' '.join(map(to_string, args))
73
+-    return undefined
74
+\ No newline at end of file
75
++    print(' '.join(map(to_string, args)))
76
++    return undefined
77
+
78
+diff --git a/js2py/test_internals.py b/js2py/test_internals.py
79
+index 12cf4ad..546ae18 100644
80
+--- a/js2py/test_internals.py
81
+@@ -6,4 +6,4 @@ x = r'''
82
+ function g() {var h123 = 11; return [function g1() {return h123}, new Function('return h123')]}
83
+ g()[1]()
84
+ '''
85
+-print seval.eval_js_vm(x)
86
++print(seval.eval_js_vm(x))
0 87
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+%{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
1
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+
3
+Summary:        Pure Python JavaScript Translator/Interpreter.
4
+Name:           python-Js2Py
5
+Version:        0.50
6
+Release:        1%{?dist}
7
+License:        MIT License
8
+Group:          Development/Languages/Python
9
+Vendor:         VMware, Inc.
10
+Distribution:   Photon
11
+Url:            https://pypi.python.org/pypi/Js2Py/0.50
12
+Source0:        https://files.pythonhosted.org/packages/source/J/Js2Py/Js2Py-%{version}.tar.gz
13
+%define         sha1 Js2Py=47fd81f40a74a4752fce3fc81728740475bdd3fc
14
+Patch0:         js2py-python3-print.patch
15
+BuildRequires:  python2
16
+BuildRequires:  python2-libs
17
+BuildRequires:  python2-devel
18
+BuildRequires:  python-setuptools
19
+BuildRequires:  python-six
20
+
21
+Requires:       python2
22
+Requires:       python2-libs
23
+Requires:       python-tzlocal
24
+Requires:       python-pyjsparser
25
+Requires:       python-six
26
+
27
+BuildArch:      noarch
28
+
29
+%description
30
+Pure Python JavaScript Translator/Interpreter.
31
+Everything is done in 100% pure Python so it's extremely easy to install and use. Supports Python 2 & 3. Full support for ECMAScript 5.1, ECMA 6 support is still experimental.
32
+
33
+%package -n     python3-Js2Py
34
+Summary:        python-Js2Py
35
+BuildRequires:  python3-devel
36
+BuildRequires:  python3-libs
37
+BuildRequires:  python3-six
38
+
39
+Requires:       python3
40
+Requires:       python3-libs
41
+Requires:       python3-six
42
+Requires:       python3-tzlocal
43
+Requires:       python3-pyjsparser
44
+
45
+%description -n python3-Js2Py
46
+Python 3 version.
47
+
48
+%prep
49
+%setup -q -n Js2Py-%{version}
50
+%patch0 -p1
51
+rm -rf ../p3dir
52
+cp -a . ../p3dir
53
+
54
+%build
55
+python2 setup.py build
56
+pushd ../p3dir
57
+python3 setup.py build
58
+popd
59
+
60
+%install
61
+python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
62
+pushd ../p3dir
63
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
64
+popd
65
+
66
+%files
67
+%defattr(-,root,root)
68
+%{python2_sitelib}/*
69
+
70
+%files -n python3-Js2Py
71
+%defattr(-,root,root)
72
+%{python3_sitelib}/*
73
+
74
+%changelog
75
+*   Fri Sep 08 2017 Xiaolin Li <xiaolinl@vmware.com> 0.50-1
76
+-   Initial packaging for Photon
0 77
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+%{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
1
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+
3
+Summary:        Fast javascript parser (based on esprima.js).
4
+Name:           python-pyjsparser
5
+Version:        2.5.2
6
+Release:        1%{?dist}
7
+License:        MIT License
8
+Group:          Development/Languages/Python
9
+Vendor:         VMware, Inc.
10
+Distribution:   Photon
11
+Url:            https://pypi.python.org/pypi/pyjsparser/2.5.2
12
+Source0:        https://files.pythonhosted.org/packages/source/p/pyjsparser/pyjsparser-%{version}.tar.gz
13
+%define         sha1 pyjsparser=5a03ca6042b2f5bb2226158c8e7f15210f4eb38e
14
+BuildRequires:  python2
15
+BuildRequires:  python2-libs
16
+BuildRequires:  python2-devel
17
+BuildRequires:  python-setuptools
18
+BuildRequires:  python-six
19
+
20
+Requires:       python2
21
+Requires:       python2-libs
22
+
23
+BuildArch:      noarch
24
+
25
+%description
26
+Fast javascript parser (based on esprima.js).
27
+
28
+%package -n     python3-pyjsparser
29
+Summary:        python-pyjsparser
30
+BuildRequires:  python3-devel
31
+BuildRequires:  python3-libs
32
+BuildRequires:  python3-six
33
+
34
+Requires:       python3
35
+Requires:       python3-libs
36
+
37
+%description -n python3-pyjsparser
38
+Python 3 version.
39
+
40
+%prep
41
+%setup -q -n pyjsparser-%{version}
42
+rm -rf ../p3dir
43
+cp -a . ../p3dir
44
+
45
+%build
46
+python2 setup.py build
47
+pushd ../p3dir
48
+python3 setup.py build
49
+popd
50
+
51
+%install
52
+python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
53
+pushd ../p3dir
54
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
55
+popd
56
+
57
+%files
58
+%defattr(-,root,root)
59
+%{python2_sitelib}/*
60
+
61
+%files -n python3-pyjsparser
62
+%defattr(-,root,root)
63
+%{python3_sitelib}/*
64
+
65
+%changelog
66
+*   Fri Sep 08 2017 Xiaolin Li <xiaolinl@vmware.com> 2.5.2-1
67
+-   Initial packaging for Photon
0 68
new file mode 100644
... ...
@@ -0,0 +1,75 @@
0
+%{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
1
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+
3
+Summary:        tzinfo object for the local timezone.
4
+Name:           python-tzlocal
5
+Version:        1.4
6
+Release:        1%{?dist}
7
+License:        MIT License
8
+Group:          Development/Languages/Python
9
+Vendor:         VMware, Inc.
10
+Distribution:   Photon
11
+Url:            https://pypi.python.org/pypi/tzlocal/1.4
12
+Source0:        https://files.pythonhosted.org/packages/source/t/tzlocal/tzlocal-%{version}.tar.gz
13
+%define         sha1 tzlocal=98da003bd7e4aba02cfb6d1d62a8b5576c666310
14
+BuildRequires:  python2
15
+BuildRequires:  python2-libs
16
+BuildRequires:  python2-devel
17
+BuildRequires:  python-setuptools
18
+BuildRequires:  python-six
19
+
20
+Requires:       python2
21
+Requires:       python2-libs
22
+Requires:       python-pytz
23
+BuildArch:      noarch
24
+
25
+%description
26
+This Python module returns a tzinfo object with the local timezone information under Unix and Win-32. It requires pytz, and returns pytz tzinfo objects.
27
+
28
+This module attempts to fix a glaring hole in pytz, that there is no way to get the local timezone information, unless you know the zoneinfo name, and under several Linux distros that’s hard or impossible to figure out.
29
+
30
+Also, with Windows different timezone system using pytz isn’t of much use unless you separately configure the zoneinfo timezone name.
31
+
32
+With tzlocal you only need to call get_localzone() and you will get a tzinfo object with the local time zone info. On some Unices you will still not get to know what the timezone name is, but you don’t need that when you have the tzinfo file. However, if the timezone name is readily available it will be used.
33
+
34
+%package -n     python3-tzlocal
35
+Summary:        python-tzlocal
36
+BuildRequires:  python3-devel
37
+BuildRequires:  python3-libs
38
+BuildRequires:  python3-six
39
+
40
+Requires:       python3
41
+Requires:       python3-libs
42
+Requires:       python3-pytz
43
+
44
+%description -n python3-tzlocal
45
+Python 3 version.
46
+
47
+%prep
48
+%setup -q -n tzlocal-%{version}
49
+rm -rf ../p3dir
50
+cp -a . ../p3dir
51
+
52
+%build
53
+python2 setup.py build
54
+pushd ../p3dir
55
+python3 setup.py build
56
+popd
57
+
58
+%install
59
+python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
60
+pushd ../p3dir
61
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
62
+popd
63
+
64
+%files
65
+%defattr(-,root,root)
66
+%{python2_sitelib}/*
67
+
68
+%files -n python3-tzlocal
69
+%defattr(-,root,root)
70
+%{python3_sitelib}/*
71
+
72
+%changelog
73
+*   Fri Sep 08 2017 Xiaolin Li <xiaolinl@vmware.com> 1.4-1
74
+-   Initial packaging for Photon