freebsd-ports/astro/py-ephem/files/patch-setup.py
Kubilay Kocak 17f97dd01c MFH: r520162 [NEW] astro/py-ephem: Compute positions of the planets and stars
PyEphem provides an ephem Python package for performing high-precision
astronomy computations. The underlying numeric routines are coded in C
and are the same ones that drive the popular XEphem astronomy application,
whose author, Elwood Charles Downey, generously gave permission for their
use in PyEphem. The name ephem is short for the word ephemeris, which is
the traditional term for a table giving the position of a planet, asteroid,
or comet for a series of dates.

WWW: https://rhodesmill.org/pyephem/
WWW: https://pypi.org/project/ephem/

[1] Based on astro/pyephem

PR: 		240736
Submitted by:	Rainer Hurling <rhurlin gwdg de>

Approved by:	ports-secteam (joneum)
2019-12-20 10:07:27 +00:00

32 lines
1.0 KiB
Python

--- setup.py.orig 2019-08-17 17:39:14 UTC
+++ setup.py
@@ -1,4 +1,13 @@
+# Currently ephem fails if the text files contain unicode characters.
+# To fix this we need to open the files as utf-8 explicitly.
+# Since open() in Python 2 doesn't support an encoding parameter,
+# TODO: Upstream
+#
+# Add setup.py test command support to run tests
+# TODO: Upstream
+
import os
+import io
import sys
from distutils.core import setup, Extension
from glob import glob
@@ -24,7 +33,7 @@ libastro_files = glob('libastro-%s/*.c' % libastro_ver
libastro_data = glob('extensions/data/*.c')
def read(*filenames):
- return open(os.path.join(os.path.dirname(__file__), *filenames)).read()
+ return io.open(os.path.join(os.path.dirname(__file__), *filenames), encoding="utf-8").read()
extensions = [
Extension('ephem._libastro',
@@ -62,4 +71,5 @@ setup(name = 'ephem',
'tests/usno/*.txt',
],},
ext_modules = extensions,
+ test_suite='ephem.tests',
)