-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1236 from inclement/sympy_recipe
Added sympy recipe
- Loading branch information
Showing
5 changed files
with
303 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
from pythonforandroid.recipe import PythonRecipe | ||
|
||
|
||
class SympyRecipe(PythonRecipe): | ||
version = '1.1.1' | ||
url = 'https://github.com/sympy/sympy/releases/download/sympy-{version}/sympy-{version}.tar.gz' | ||
|
||
depends = [('python2', 'python3crystax'), 'mpmath'] | ||
|
||
call_hostpython_via_targetpython = True | ||
|
||
patches = ['fix_timeutils.patch', 'fix_pretty_print.patch'] | ||
|
||
|
||
recipe = SympyRecipe() |
47 changes: 47 additions & 0 deletions
47
pythonforandroid/recipes/sympy/fix_android_detection.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
diff --git a/pip/download.py b/pip/download.py | ||
index 54d3131..1aab70f 100644 | ||
--- a/pip/download.py | ||
+++ b/pip/download.py | ||
@@ -89,23 +89,25 @@ def user_agent(): | ||
# Complete Guess | ||
data["implementation"]["version"] = platform.python_version() | ||
|
||
- if sys.platform.startswith("linux"): | ||
- from pip._vendor import distro | ||
- distro_infos = dict(filter( | ||
- lambda x: x[1], | ||
- zip(["name", "version", "id"], distro.linux_distribution()), | ||
- )) | ||
- libc = dict(filter( | ||
- lambda x: x[1], | ||
- zip(["lib", "version"], libc_ver()), | ||
- )) | ||
- if libc: | ||
- distro_infos["libc"] = libc | ||
- if distro_infos: | ||
- data["distro"] = distro_infos | ||
- | ||
- if sys.platform.startswith("darwin") and platform.mac_ver()[0]: | ||
- data["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]} | ||
+ # if sys.platform.startswith("linux"): | ||
+ # from pip._vendor import distro | ||
+ # distro_infos = dict(filter( | ||
+ # lambda x: x[1], | ||
+ # zip(["name", "version", "id"], distro.linux_distribution()), | ||
+ # )) | ||
+ # libc = dict(filter( | ||
+ # lambda x: x[1], | ||
+ # zip(["lib", "version"], libc_ver()), | ||
+ # )) | ||
+ # if libc: | ||
+ # distro_infos["libc"] = libc | ||
+ # if distro_infos: | ||
+ # data["distro"] = distro_infos | ||
+ | ||
+ # if sys.platform.startswith("darwin") and platform.mac_ver()[0]: | ||
+ # data["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]} | ||
+ | ||
+ data['distro'] = {'name': 'Android'} | ||
|
||
if platform.system(): | ||
data.setdefault("system", {})["name"] = platform.system() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py | ||
index 604e97c..ddd3eb2 100644 | ||
--- a/sympy/printing/pretty/pretty.py | ||
+++ b/sympy/printing/pretty/pretty.py | ||
@@ -166,14 +166,14 @@ class PrettyPrinter(Printer): | ||
arg = e.args[0] | ||
pform = self._print(arg) | ||
if isinstance(arg, Equivalent): | ||
- return self._print_Equivalent(arg, altchar=u"\N{NOT IDENTICAL TO}") | ||
+ return self._print_Equivalent(arg, altchar=u"NOT IDENTICAL TO") | ||
if isinstance(arg, Implies): | ||
- return self._print_Implies(arg, altchar=u"\N{RIGHTWARDS ARROW WITH STROKE}") | ||
+ return self._print_Implies(arg, altchar=u"RIGHTWARDS ARROW WITH STROKE") | ||
|
||
if arg.is_Boolean and not arg.is_Not: | ||
pform = prettyForm(*pform.parens()) | ||
|
||
- return prettyForm(*pform.left(u"\N{NOT SIGN}")) | ||
+ return prettyForm(*pform.left(u"NOT SIGN")) | ||
else: | ||
return self._print_Function(e) | ||
|
||
@@ -200,43 +200,43 @@ class PrettyPrinter(Printer): | ||
|
||
def _print_And(self, e): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, u"\N{LOGICAL AND}") | ||
+ return self.__print_Boolean(e, u"LOGICAL AND") | ||
else: | ||
return self._print_Function(e, sort=True) | ||
|
||
def _print_Or(self, e): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, u"\N{LOGICAL OR}") | ||
+ return self.__print_Boolean(e, u"LOGICAL OR") | ||
else: | ||
return self._print_Function(e, sort=True) | ||
|
||
def _print_Xor(self, e): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, u"\N{XOR}") | ||
+ return self.__print_Boolean(e, u"XOR") | ||
else: | ||
return self._print_Function(e, sort=True) | ||
|
||
def _print_Nand(self, e): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, u"\N{NAND}") | ||
+ return self.__print_Boolean(e, u"NAND") | ||
else: | ||
return self._print_Function(e, sort=True) | ||
|
||
def _print_Nor(self, e): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, u"\N{NOR}") | ||
+ return self.__print_Boolean(e, u"NOR") | ||
else: | ||
return self._print_Function(e, sort=True) | ||
|
||
def _print_Implies(self, e, altchar=None): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, altchar or u"\N{RIGHTWARDS ARROW}", sort=False) | ||
+ return self.__print_Boolean(e, altchar or u"RIGHTWARDS ARROW", sort=False) | ||
else: | ||
return self._print_Function(e) | ||
|
||
def _print_Equivalent(self, e, altchar=None): | ||
if self._use_unicode: | ||
- return self.__print_Boolean(e, altchar or u"\N{IDENTICAL TO}") | ||
+ return self.__print_Boolean(e, altchar or u"IDENTICAL TO") | ||
else: | ||
return self._print_Function(e, sort=True) | ||
|
||
@@ -425,7 +425,7 @@ class PrettyPrinter(Printer): | ||
if self._use_unicode: | ||
# use unicode corners | ||
horizontal_chr = xobj('-', 1) | ||
- corner_chr = u'\N{BOX DRAWINGS LIGHT DOWN AND HORIZONTAL}' | ||
+ corner_chr = u'BOX DRAWINGS LIGHT DOWN AND HORIZONTAL' | ||
|
||
func_height = pretty_func.height() | ||
|
||
@@ -580,7 +580,7 @@ class PrettyPrinter(Printer): | ||
|
||
LimArg = self._print(z) | ||
if self._use_unicode: | ||
- LimArg = prettyForm(*LimArg.right(u'\N{BOX DRAWINGS LIGHT HORIZONTAL}\N{RIGHTWARDS ARROW}')) | ||
+ LimArg = prettyForm(*LimArg.right(u'BOX DRAWINGS LIGHT HORIZONTALRIGHTWARDS ARROW')) | ||
else: | ||
LimArg = prettyForm(*LimArg.right('->')) | ||
LimArg = prettyForm(*LimArg.right(self._print(z0))) | ||
@@ -589,7 +589,7 @@ class PrettyPrinter(Printer): | ||
dir = "" | ||
else: | ||
if self._use_unicode: | ||
- dir = u'\N{SUPERSCRIPT PLUS SIGN}' if str(dir) == "+" else u'\N{SUPERSCRIPT MINUS}' | ||
+ dir = u'SUPERSCRIPT PLUS SIGN' if str(dir) == "+" else u'SUPERSCRIPT MINUS' | ||
|
||
LimArg = prettyForm(*LimArg.right(self._print(dir))) | ||
|
||
@@ -740,7 +740,7 @@ class PrettyPrinter(Printer): | ||
def _print_Adjoint(self, expr): | ||
pform = self._print(expr.arg) | ||
if self._use_unicode: | ||
- dag = prettyForm(u'\N{DAGGER}') | ||
+ dag = prettyForm(u'DAGGER') | ||
else: | ||
dag = prettyForm('+') | ||
from sympy.matrices import MatrixSymbol | ||
@@ -850,8 +850,8 @@ class PrettyPrinter(Printer): | ||
if '\n' in partstr: | ||
tempstr = partstr | ||
tempstr = tempstr.replace(vectstrs[i], '') | ||
- tempstr = tempstr.replace(u'\N{RIGHT PARENTHESIS UPPER HOOK}', | ||
- u'\N{RIGHT PARENTHESIS UPPER HOOK}' | ||
+ tempstr = tempstr.replace(u'RIGHT PARENTHESIS UPPER HOOK', | ||
+ u'RIGHT PARENTHESIS UPPER HOOK' | ||
+ ' ' + vectstrs[i]) | ||
o1[i] = tempstr | ||
o1 = [x.split('\n') for x in o1] | ||
@@ -1153,7 +1153,7 @@ class PrettyPrinter(Printer): | ||
def _print_Lambda(self, e): | ||
vars, expr = e.args | ||
if self._use_unicode: | ||
- arrow = u" \N{RIGHTWARDS ARROW FROM BAR} " | ||
+ arrow = u" RIGHTWARDS ARROW FROM BAR " | ||
else: | ||
arrow = " -> " | ||
if len(vars) == 1: | ||
@@ -1173,7 +1173,7 @@ class PrettyPrinter(Printer): | ||
elif len(expr.variables): | ||
pform = prettyForm(*pform.right(self._print(expr.variables[0]))) | ||
if self._use_unicode: | ||
- pform = prettyForm(*pform.right(u" \N{RIGHTWARDS ARROW} ")) | ||
+ pform = prettyForm(*pform.right(u" RIGHTWARDS ARROW ")) | ||
else: | ||
pform = prettyForm(*pform.right(" -> ")) | ||
if len(expr.point) > 1: | ||
@@ -1462,7 +1462,7 @@ class PrettyPrinter(Printer): | ||
and expt is S.Half and bpretty.height() == 1 | ||
and (bpretty.width() == 1 | ||
or (base.is_Integer and base.is_nonnegative))): | ||
- return prettyForm(*bpretty.left(u'\N{SQUARE ROOT}')) | ||
+ return prettyForm(*bpretty.left(u'SQUARE ROOT')) | ||
|
||
# Construct root sign, start with the \/ shape | ||
_zZ = xobj('/', 1) | ||
@@ -1558,7 +1558,7 @@ class PrettyPrinter(Printer): | ||
from sympy import Pow | ||
return self._print(Pow(p.sets[0], len(p.sets), evaluate=False)) | ||
else: | ||
- prod_char = u"\N{MULTIPLICATION SIGN}" if self._use_unicode else 'x' | ||
+ prod_char = u"MULTIPLICATION SIGN" if self._use_unicode else 'x' | ||
return self._print_seq(p.sets, None, None, ' %s ' % prod_char, | ||
parenthesize=lambda set: set.is_Union or | ||
set.is_Intersection or set.is_ProductSet) | ||
@@ -1570,7 +1570,7 @@ class PrettyPrinter(Printer): | ||
def _print_Range(self, s): | ||
|
||
if self._use_unicode: | ||
- dots = u"\N{HORIZONTAL ELLIPSIS}" | ||
+ dots = u"HORIZONTAL ELLIPSIS" | ||
else: | ||
dots = '...' | ||
|
||
@@ -1641,7 +1641,7 @@ class PrettyPrinter(Printer): | ||
|
||
def _print_ImageSet(self, ts): | ||
if self._use_unicode: | ||
- inn = u"\N{SMALL ELEMENT OF}" | ||
+ inn = u"SMALL ELEMENT OF" | ||
else: | ||
inn = 'in' | ||
variables = self._print_seq(ts.lamda.variables) | ||
@@ -1653,10 +1653,10 @@ class PrettyPrinter(Printer): | ||
|
||
def _print_ConditionSet(self, ts): | ||
if self._use_unicode: | ||
- inn = u"\N{SMALL ELEMENT OF}" | ||
+ inn = u"SMALL ELEMENT OF" | ||
# using _and because and is a keyword and it is bad practice to | ||
# overwrite them | ||
- _and = u"\N{LOGICAL AND}" | ||
+ _and = u"LOGICAL AND" | ||
else: | ||
inn = 'in' | ||
_and = 'and' | ||
@@ -1677,7 +1677,7 @@ class PrettyPrinter(Printer): | ||
|
||
def _print_ComplexRegion(self, ts): | ||
if self._use_unicode: | ||
- inn = u"\N{SMALL ELEMENT OF}" | ||
+ inn = u"SMALL ELEMENT OF" | ||
else: | ||
inn = 'in' | ||
variables = self._print_seq(ts.variables) | ||
@@ -1690,7 +1690,7 @@ class PrettyPrinter(Printer): | ||
def _print_Contains(self, e): | ||
var, set = e.args | ||
if self._use_unicode: | ||
- el = u" \N{ELEMENT OF} " | ||
+ el = u" ELEMENT OF " | ||
return prettyForm(*stringPict.next(self._print(var), | ||
el, self._print(set)), binding=8) | ||
else: | ||
@@ -1698,7 +1698,7 @@ class PrettyPrinter(Printer): | ||
|
||
def _print_FourierSeries(self, s): | ||
if self._use_unicode: | ||
- dots = u"\N{HORIZONTAL ELLIPSIS}" | ||
+ dots = u"HORIZONTAL ELLIPSIS" | ||
else: | ||
dots = '...' | ||
return self._print_Add(s.truncate()) + self._print(dots) | ||
@@ -1708,7 +1708,7 @@ class PrettyPrinter(Printer): | ||
|
||
def _print_SeqFormula(self, s): | ||
if self._use_unicode: | ||
- dots = u"\N{HORIZONTAL ELLIPSIS}" | ||
+ dots = u"HORIZONTAL ELLIPSIS" | ||
else: | ||
dots = '...' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/sympy/utilities/timeutils.py b/sympy/utilities/timeutils.py | ||
index 3770d85..c53594e 100644 | ||
--- a/sympy/utilities/timeutils.py | ||
+++ b/sympy/utilities/timeutils.py | ||
@@ -8,7 +8,7 @@ import math | ||
from sympy.core.compatibility import range | ||
|
||
_scales = [1e0, 1e3, 1e6, 1e9] | ||
-_units = [u's', u'ms', u'\N{GREEK SMALL LETTER MU}s', u'ns'] | ||
+_units = [u's', u'ms', u'mus', u'ns'] | ||
|
||
|
||
def timed(func, setup="pass", limit=None): |