Hello community, here is the log from the commit of package python-ephem for openSUSE:Factory checked in at 2020-10-29 09:45:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ephem (Old) and /work/SRC/openSUSE:Factory/.python-ephem.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ephem" Thu Oct 29 09:45:25 2020 rev:4 rq:835116 version:3.7.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ephem/python-ephem.changes 2019-09-23 12:10:34.229874063 +0200 +++ /work/SRC/openSUSE:Factory/.python-ephem.new.3463/python-ephem.changes 2020-10-29 09:45:43.220022061 +0100 @@ -1,0 +2,9 @@ +Thu Sep 17 06:57:36 UTC 2020 - Dirk Mueller <dmuel...@suse.com> + +- update to 3.7.7.1: + * Fixed a memory leak in ``readdb()``. + * Fixed the ``Body.copy()`` method to correctly copy + object-specific fields across to the new object, like Saturn ring tilt + and Earth satellite catalog number. + +------------------------------------------------------------------- Old: ---- v3.7.7.0.tar.gz New: ---- v3.7.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ephem.spec ++++++ --- /var/tmp/diff_new_pack.1Ha54M/_old 2020-10-29 09:45:47.812026399 +0100 +++ /var/tmp/diff_new_pack.1Ha54M/_new 2020-10-29 09:45:47.816026403 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-ephem # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define pyname pyephem Name: python-ephem -Version: 3.7.7.0 +Version: 3.7.7.1 Release: 0 Summary: Scientific-grade astronomy routines for Python License: LGPL-3.0-only ++++++ v3.7.7.0.tar.gz -> v3.7.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/.travis.yml new/pyephem-3.7.7.1/.travis.yml --- old/pyephem-3.7.7.0/.travis.yml 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/.travis.yml 2020-02-22 23:21:45.000000000 +0100 @@ -1,37 +1,14 @@ -# Config file for automatic testing at travis-ci.org -# -# python: ["2.6", "2.7", "3.2", "3.3", "3.4", "3.5", "3.6"] - language: python +python: + - "2.7" + - "3.4" + - "3.5" + - "3.6" + - "3.7" + - "3.8" -matrix: - include: - - sudo: required - services: - - docker - env: PIP=pip - - os: osx - language: generic - env: PIP=pip2 +install: + - pip install -e . script: - - "pip install -e ." - - "if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]] ;then pip install unittest2 ;fi" - - "if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]] ;then unit2 discover ephem ;else python -m unittest discover ephem ;fi" - - "pip uninstall --yes ephem" - - "rm -r build" - - $PIP install cibuildwheel==0.11.1 - - cibuildwheel --output-dir wheelhouse - -deploy: - provider: s3 - access_key_id: - secure: "UMFVnMJ0beiBKCDdNUupPoo++JLIqAjHbC5oXNCF/+DaFEYdteRqzfg0DhQbw654RkfjvSdAvxVE9ITvUyFyozPsiDxNa2bLaFhxXQJGf01Yido2ULiCPNsv11WZJibd0ps64ZR39A4gdeGHn736UJkiis8nFP0frVh1VMVNhGk=" - secret_access_key: - secure: "Eam5NddSwZvGgQ8sHjD99Wxnh6250IvkHeqd/5eGuqr8GJJiwmHoIO/eHwh24K2Oc6XskyCrGULqzqrELbmn3YXVXrl1AWgfC/slL5xic0z4Pt06WR9ztCoV0Tpl7bz8gN+8I3Pym52ygT/e9fi0yKwY88qQArh9ZXcP/3uJxT0=" - bucket: - secure: "IaoloKRARTEbkHW1x8EmnVdcxR2HZyAPI43ldI0uTdea0jgrBQk1QqKzfECgn+lFPc7/TdCMVFFod9kwVTRSbWUb1DMvswvrXlvQu7u2dtcBhw9JAkDFJwjVQw2uBDKPqCBFbQPrUiEsgw+8pBGdeDYlRiCtiGx8bg1EHKLo5L4=" - skip_cleanup: true - local_dir: wheelhouse - on: - tags: true + - python -m unittest discover ephem diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/README.rst new/pyephem-3.7.7.1/README.rst --- old/pyephem-3.7.7.0/README.rst 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/README.rst 2020-02-22 23:21:45.000000000 +0100 @@ -2,9 +2,6 @@ PyEphem README ============== -.. image:: http://bottlepy.org/docs/dev/_static/Gittip.png - :target: https://www.gittip.com/brandon-rhodes/ - .. image:: https://travis-ci.org/brandon-rhodes/pyephem.png :target: https://travis-ci.org/brandon-rhodes/pyephem diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/appveyor/install.ps1 new/pyephem-3.7.7.1/appveyor/install.ps1 --- old/pyephem-3.7.7.0/appveyor/install.ps1 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/appveyor/install.ps1 1970-01-01 01:00:00.000000000 +0100 @@ -1,85 +0,0 @@ -# Sample script to install Python and pip under Windows -# Authors: Olivier Grisel and Kyle Kastner -# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ - -$BASE_URL = "https://www.python.org/ftp/python/" -$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" -$GET_PIP_PATH = "C:\get-pip.py" - - -function DownloadPython ($python_version, $platform_suffix) { - $webclient = New-Object System.Net.WebClient - $filename = "python-" + $python_version + $platform_suffix + ".msi" - $url = $BASE_URL + $python_version + "/" + $filename - - $basedir = $pwd.Path + "\" - $filepath = $basedir + $filename - if (Test-Path $filename) { - Write-Host "Reusing" $filepath - return $filepath - } - - # Download and retry up to 5 times in case of network transient errors. - Write-Host "Downloading" $filename "from" $url - $retry_attempts = 3 - for($i=0; $i -lt $retry_attempts; $i++){ - try { - $webclient.DownloadFile($url, $filepath) - break - } - Catch [Exception]{ - Start-Sleep 1 - } - } - Write-Host "File saved at" $filepath - return $filepath -} - - -function InstallPython ($python_version, $architecture, $python_home) { - Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home - if (Test-Path $python_home) { - Write-Host $python_home "already exists, skipping." - return $false - } - if ($architecture -eq "32") { - $platform_suffix = "" - } else { - $platform_suffix = ".amd64" - } - $filepath = DownloadPython $python_version $platform_suffix - Write-Host "Installing" $filepath "to" $python_home - $args = "/qn /i $filepath TARGETDIR=$python_home" - Write-Host "msiexec.exe" $args - Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru - Write-Host "Python $python_version ($architecture) installation complete" - return $true -} - - -function InstallPip ($python_home) { - $pip_path = $python_home + "/Scripts/pip.exe" - $python_path = $python_home + "/python.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $webclient = New-Object System.Net.WebClient - $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) - Write-Host "Executing:" $python_path $GET_PIP_PATH - Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru - } else { - Write-Host "pip already installed." - } -} - -function InstallPackage ($python_home, $pkg) { - $pip_path = $python_home + "/Scripts/pip.exe" - & $pip_path install $pkg -} - -function main () { - InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON - InstallPip $env:PYTHON - InstallPackage $env:PYTHON wheel -} - -main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/appveyor/run_with_compiler.cmd new/pyephem-3.7.7.1/appveyor/run_with_compiler.cmd --- old/pyephem-3.7.7.0/appveyor/run_with_compiler.cmd 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/appveyor/run_with_compiler.cmd 1970-01-01 01:00:00.000000000 +0100 @@ -1,47 +0,0 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds do not require specific environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ -@ECHO OFF - -SET COMMAND_TO_RUN=%* -SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows - -SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" -IF %MAJOR_PYTHON_VERSION% == "2" ( - SET WINDOWS_SDK_VERSION="v7.0" -) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( - SET WINDOWS_SDK_VERSION="v7.1" -) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 -) - -IF "%PYTHON_ARCH%"=="64" ( - ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) ELSE ( - ECHO Using default MSVC build environment for 32 bit architecture - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/appveyor.yml new/pyephem-3.7.7.1/appveyor.yml --- old/pyephem-3.7.7.0/appveyor.yml 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/appveyor.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -build_script: - - pip install cibuildwheel==0.11.1 - - cibuildwheel --output-dir wheelhouse -artifacts: - - path: "wheelhouse\\*.whl" - name: Wheels diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/ephem/__init__.py new/pyephem-3.7.7.1/ephem/__init__.py --- old/pyephem-3.7.7.0/ephem/__init__.py 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/ephem/__init__.py 2020-02-22 23:21:45.000000000 +0100 @@ -9,7 +9,7 @@ from math import pi from time import localtime as _localtime -__version__ = '3.7.7.0' +__version__ = '3.7.7.1' twopi = pi * 2. halfpi = pi / 2. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/ephem/doc/CHANGELOG.rst new/pyephem-3.7.7.1/ephem/doc/CHANGELOG.rst --- old/pyephem-3.7.7.0/ephem/doc/CHANGELOG.rst 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/ephem/doc/CHANGELOG.rst 2020-02-22 23:21:45.000000000 +0100 @@ -1,6 +1,22 @@ PyEphem CHANGELOG ================= +Next +---- + +- Fixed the body ``copy()`` method to correct copy the extra attributes + that some bodies have beyond those of a normal body, like the catalog + number of an Earth satellite. This bug had made core dumps possible. + +Version 3.7.7.1 (2020 February 22) +---------------------------------- + +- GitHub issue #166: Fixed a memory leak in ``readdb()``. + +- GitHub issue #119: Fixed the ``Body.copy()`` method to correctly copy + object-specific fields across to the new object, like Saturn ring tilt + and Earth satellite catalog number. + Version 3.7.7.0 (2019 August 18) -------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/ephem/doc/index.rst new/pyephem-3.7.7.1/ephem/doc/index.rst --- old/pyephem-3.7.7.0/ephem/doc/index.rst 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/ephem/doc/index.rst 2020-02-22 23:21:45.000000000 +0100 @@ -106,20 +106,51 @@ </div> -Alas, PyEphem is deprecated -=========================== +PyEphem is in maintenance mode +============================== -First, **don’t worry** — -PyEphem isn’t going to disappear! +The PyEphem astronomy library +has helped generations of Python programmers +locate the stars, planets, and Earth satellites. +It **will continue to receive bugfixes** +and **will be ported to new versions of Python**, +but it no longer stands at the cutting edge of astronomy in Python. -It will continue to be available on PyPI, -continue to receive critical bug fixes, -and continue to run on both Python 2 and Python 3. - -But PyEphem’s design has several flaws -that I did not know to avoid -back when I started designing it in the late 1990s -and early 2000s: +See below for newer alternatives +that offer a more Pythonic approach to astronomy in Python! + +What is PyEphem? +================ + +**PyEphem** provides basic astronomical computations +for the Python_ programming language. +Given a date and location on the Earth's surface, +it can compute the positions of the Sun and Moon, +of the planets and their moons, +and of any asteroids, comets, or earth satellites +whose orbital elements the user can provide. +Additional functions are provided to compute the angular separation +between two objects in the sky, +to determine the constellation in which an object lies, +and to find the times at which +an object rises, transits, and sets on a particular day. + +.. _Python: http://www.python.org/ + +The numerical routines that lie behind PyEphem +are those from the wonderful XEphem_ astronomy application, +whose author, Elwood Downey, generously gave permission +for us to use them as the basis for PyEphem. + +.. _XEphem: http://www.clearskyinstitute.com/xephem/ + +Awkward edges +============= + +PyEphem’s design has several flaws +that have been avoided by the newer astronomy libraries +listed in the next section. +Among the problems it creates for Python programmers are: * Instead of offering a clear way for the user to specify units of radians or degrees, @@ -132,7 +163,8 @@ and can never be fixed because it would break all existing PyEphem programs. -* The API is also awkward because it is not functional. +* The API is also awkward + because it mutates objects in-place instead of returning results. Instead of returning coordinates directly, ``compute()`` updates several fields on its object — reflecting how the underlying C library works, which I didn’t write. @@ -158,7 +190,7 @@ had often thought about starting over again so I would have a second chance to avoid the mistakes I made with PyEphem! -It was only in 2013 (thirteen years late!) +It was only in 2013 that I discovered an excellent excuse: back in the year 2000, the IAU (International Astronomical Union) had @@ -172,7 +204,7 @@ Following the United States Naval Observatory’s free “NOVAS” library’s C code as my example (for which they -also maintains a `Python interface <http://aa.usno.navy.mil/software/novas/novas_py/novaspy_intro.php>`_), +also maintain a `Python interface <http://aa.usno.navy.mil/software/novas/novas_py/novaspy_intro.php>`_), I started writing a new library that I named “Skyfield” with the goal of implementing the highest accuracy algorithms, using only Python and NumPy, @@ -185,8 +217,7 @@ I recommend using Skyfield instead of PyEphem if it’s possible for your new project to do so! (The only thing missing at this point is predicting positions -from Kelperian orbital elements for comets and astroids — -though I hope to add that by the end of 2018.) +from Kelperian orbital elements for comets and asteroids.) If you are a professional astronomer interested in writing programs that interoperate @@ -202,38 +233,11 @@ But if you want it anyway, PyEphem is still available. -What is PyEphem? -================ - -**PyEphem** provides basic astronomical computations -for the Python_ programming language. -Given a date and location on the Earth's surface, -it can compute the positions of the Sun and Moon, -of the planets and their moons, -and of any asteroids, comets, or earth satellites -whose orbital elements the user can provide. -Additional functions are provided to compute the angular separation -between two objects in the sky, -to determine the constellation in which an object lies, -and to find the times at which -an object rises, transits, and sets on a particular day. - -.. _Python: http://www.python.org/ - -The numerical routines that lie behind PyEphem -are those from the wonderful XEphem_ astronomy application, -whose author, Elwood Downey, generously gave permission -for us to use them as the basis for PyEphem. - -.. _XEphem: http://www.clearskyinstitute.com/xephem/ - Installation ------------ -Version **3.7.6.0** is the most recent release of PyEphem. -Consult the `change log`_ to see the new features! - -.. _change log: CHANGELOG +Version **3.7.7.1** is the most recent release of PyEphem. +Consult the :doc:`CHANGELOG` to see the new features! The easiest way to install PyEphem on a Linux or Mac OS machine, after making sure that “Python.h” and the other Python header files diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/ephem/doc/quick.rst new/pyephem-3.7.7.1/ephem/doc/quick.rst --- old/pyephem-3.7.7.0/ephem/doc/quick.rst 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/ephem/doc/quick.rst 2020-02-22 23:21:45.000000000 +0100 @@ -90,7 +90,9 @@ | ``g_ra`` and ``ra`` — `Apparent geocentric`_ right ascension for the epoch-of-date | ``g_dec`` and ``dec`` — `Apparent geocentric`_ declination for the epoch-of-date - | ``elong`` — Elongation (angle to sun) + | ``elong`` — Elongation: the angle between the Sun and the body, + but with the sign flipped to negative + when the body is on the morning side of the sky. | ``mag`` — Magnitude | ``size`` — Size (diameter in arcseconds) | ``radius`` — Size (radius as an angle) @@ -506,8 +508,10 @@ * A ``ValueError`` signals a non-existent place. -transit, rising, setting ------------------------- +.. _transit-rising-setting: + +transit, rising, and setting +---------------------------- >>> sitka = ephem.Observer() >>> sitka.date = '1999/6/27' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/ephem/doc/tutorial.rst new/pyephem-3.7.7.1/ephem/doc/tutorial.rst --- old/pyephem-3.7.7.0/ephem/doc/tutorial.rst 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/ephem/doc/tutorial.rst 2020-02-22 23:21:45.000000000 +0100 @@ -50,7 +50,7 @@ Calling ``compute()`` sets many attributes of a body, beyond the right ascension, declination, and magnitude printed here; -see the `Quick Reference`_ +see the :doc:`quick` for other attributes that ``compute()`` sets. You see that measurements are formatted as an astronomer would expect: dates are expressed as year, month, and day, delimited by slashes; @@ -60,8 +60,6 @@ the more traditional 21°46′15.66′′ is not possible with the symbols on a standard computer keyboard. -.. _Quick Reference: quick - The code above created and used only one instance of ``Uranus``, but you can also have several going at once. For example, @@ -449,11 +447,9 @@ just for completeness — the moment of “anti-transit” when the object lies along the meridian directly under your feet. -See the section on `transit, rising, and setting`_ +See the section on :any:`transit-rising-setting` in the Quick Reference for more details. -.. _transit, rising, and setting: quick#transit-rising-setting - Loading Bodies From Catalogues ------------------------------ @@ -473,7 +469,7 @@ and then issue new orbital parameters as its orbit changes. The PyEphem home page provides links to several -`online catalogs`_ of orbital elements. +:doc:`catalogs` of orbital elements. Once you have obtained elements for a particular body, simply provide them to PyEphem's ``readdb()`` function in `ephem database format`_ and the resulting object is ready to use: @@ -489,7 +485,6 @@ >>> print("%s %s" % (ephem.constellation(yh), yh.mag)) ('And', 'Andromeda') 5.96 -.. _online catalogs: http://rhodesmill.org/pyephem/catalogs .. _ephem database format: http://www.clearskyinstitute.com/xephem/help/xephem.html#mozTocId468501 (Unfortunately, the library upon which PyEphem is build @@ -504,13 +499,11 @@ For objects for which you cannot find an entry in ephem database format, you can always create the appropriate kind of object and then fill in its orbital parameters yourself; -see the `Quick Reference`_ for their names and meanings. +see the :doc:`quick` for their names and meanings. By calling the ``writedb()`` function of a PyEphem object, you can even get it to generate its own database entry for archiving or distribution. -.. _Quick Reference: quick - There is one other database format with which PyEphem is familiar: the NORAD Two-Line Element format (TLE) used for earth satellites. Here are some recent elements for the International Space Station. @@ -546,9 +539,7 @@ upon the location from which you are observing. PyEphem provides extra information about earth satellites, beyond the ones available for other objects; -again, see the `Quick Reference`_ for details. - -.. _Quick Reference: quick +again, see the :doc:`quick` for details. Fixed Objects, Precession, and Epochs ------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/ephem/tests/test_satellite.py new/pyephem-3.7.7.1/ephem/tests/test_satellite.py --- old/pyephem-3.7.7.0/ephem/tests/test_satellite.py 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/ephem/tests/test_satellite.py 2020-02-22 23:21:45.000000000 +0100 @@ -1,6 +1,10 @@ # -*- coding: utf-8 -*- -import unittest, ephem +import ephem, warnings, unittest + +# Prevent the use of "assertRaisesRegexp" below from causing noise; we +# cannot upgrade to "assertRaisesRegex" without breaking older Pythons. +warnings.filterwarnings("ignore",category=DeprecationWarning) tle_lines = ( 'ISS (ZARYA) ', @@ -13,6 +17,12 @@ self.iss = ephem.readtle(*tle_lines) self.atlanta = ephem.city('Atlanta') + def test_TLE_checksum(self): + lines = list(tle_lines) + lines[1] = lines[1][:-1] + '1' + expected = 'incorrect TLE checksum at end of line' + self.assertRaisesRegexp(ValueError, expected, ephem.readtle, *lines) + def test_normal_methods(self): for which in ['previous', 'next']: for event in ['transit', 'antitransit', 'rising', 'setting']: @@ -37,7 +47,7 @@ self.assertAlmostEqual(ephem.degrees('192.0'), raz, 1) self.assertAlmostEqual(ephem.degrees('16.0'), talt, 1) self.assertAlmostEqual(ephem.degrees('64.9'), saz, 1) - + def test_next_pass_consecutive(self): # Issue #63 iss = self.iss diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/extensions/_libastro.c new/pyephem-3.7.7.1/extensions/_libastro.c --- old/pyephem-3.7.7.0/extensions/_libastro.c 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/extensions/_libastro.c 2020-02-22 23:21:45.000000000 +0100 @@ -1330,16 +1330,14 @@ return PyUnicode_FromString(line); } +void Body__copy_struct(Body *, Body *); + static PyObject* Body_copy(PyObject *self) { Body *body = (Body *) self; Body *newbody = (Body*) self->ob_type->tp_alloc(self->ob_type, 0); if (!newbody) return 0; - memcpy ((void *)&newbody->now, (void *)&body->now, sizeof(Now)); - memcpy ((void *)&newbody->obj, (void *)&body->obj, sizeof(Obj)); - memcpy ((void *)&newbody->riset, (void *)&body->riset, sizeof(RiseSet)); - newbody->name = body->name; - Py_XINCREF(newbody->name); + Body__copy_struct(body, newbody); return (PyObject*) newbody; } @@ -2644,7 +2642,6 @@ Py_DECREF(name); return 0; } - //body = PyObject_NEW(Body, type); body = (Body*) PyType_GenericNew(type, 0, 0); if (!body) { Py_DECREF(name); @@ -2654,7 +2651,9 @@ if (Set_name((PyObject*) body, name, 0) == -1) { Py_DECREF(body); Py_DECREF(name); + return 0; } + Py_DECREF(name); return (PyObject*) body; } @@ -2682,6 +2681,7 @@ static PyObject* readtle(PyObject *self, PyObject *args) { + int result; char *l0, *l1, *l2; PyObject *name, *stripped_name, *body, *catalog_number; Obj obj; @@ -2691,9 +2691,12 @@ l0 = PyUnicode_AsUTF8(name); if (!l0) return 0; - if (db_tle(l0, l1, l2, &obj)) { + result = db_tle(l0, l1, l2, &obj); + if (result) { PyErr_SetString(PyExc_ValueError, - "line does not conform to tle format"); + (result == -2) ? + "incorrect TLE checksum at end of line" : + "line does not conform to tle format"); return 0; } stripped_name = PyObject_CallMethod(name, "strip", 0); @@ -3007,6 +3010,46 @@ } } +/* + * Why is this all the way down here? It needs to refer to the type + * objects themselves, which are defined rather late in the file. + */ + +void Body__copy_struct(Body *body, Body *newbody) +{ + memcpy((void *)&newbody->now, (void *)&body->now, sizeof(Now)); + memcpy((void *)&newbody->obj, (void *)&body->obj, sizeof(Obj)); + memcpy((void *)&newbody->riset, (void *)&body->riset, sizeof(RiseSet)); + + newbody->name = body->name; + Py_XINCREF(newbody->name); + + if (PyObject_IsInstance(body, &MoonType)) { + Moon *a = (Moon *) newbody, *b = (Moon *) body; + a->llat = b->llat; + a->llon = b->llon; + a->c = b->c; + a->k = b->k; + a->s = b->s; + } + if (PyObject_IsInstance(body, &JupiterType)) { + Jupiter *a = (Jupiter *) newbody, *b = (Jupiter *) body; + a->cmlI = a->cmlI; + a->cmlII = a->cmlII; + } + if (PyObject_IsInstance(body, &SaturnType)) { + Saturn *a = (Saturn *) newbody, *b = (Saturn *) body; + a->etilt = a->etilt; + a->stilt = a->stilt; + } + if (PyObject_IsInstance(body, &EarthSatelliteType)) { + EarthSatellite *a = (EarthSatellite *) newbody; + EarthSatellite *b = (EarthSatellite *) body; + a->catalog_number = b->catalog_number; + Py_XINCREF(a->name); + } +} + /* * The global methods table and the module initialization function. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/libastro-3.7.7/dbfmt.c new/pyephem-3.7.7.1/libastro-3.7.7/dbfmt.c --- old/pyephem-3.7.7.0/libastro-3.7.7/dbfmt.c 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/libastro-3.7.7/dbfmt.c 2020-02-22 23:21:45.000000000 +0100 @@ -186,6 +186,7 @@ * name ends at first '\0', '\r' or '\n'. * set startok/endok. * if ok return 0 else return -1 + * (PyEphem enchancement:) else returns -2 for a checksum error */ int db_tle (char *name, char *l1, char *l2, Obj *op) @@ -207,9 +208,9 @@ if (strncmp (l1+2, l2+2, 5)) return (-1); if (tle_sum (l1) < 0) - return (-1); + return (-2); if (tle_sum (l2) < 0) - return (-1); + return (-2); /* assume it's ok from here out */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/pyephem/setup.py new/pyephem-3.7.7.1/pyephem/setup.py --- old/pyephem-3.7.7.0/pyephem/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pyephem-3.7.7.1/pyephem/setup.py 2020-02-22 23:21:45.000000000 +0100 @@ -0,0 +1,41 @@ +from setuptools import setup + +version = '3.7.7.0' + +long_description = ''' +This package is a stub +that contains no Python code, +but lists ``ephem`` as its install requirement +in case any old projects depend on this ``pyephem`` package name. +New projects are encouraged to directly require the main package, +which can be found at: + +`https://pypi.org/project/ephem/ <https://pypi.org/project/ephem/>`_ +''' + +setup( + name = 'pyephem', + version = version, + description = 'Empty package that depends on "ephem"', + long_description = long_description, + long_description_content_type = 'text/x-rst', + license = 'LGPL', + author = 'Brandon Rhodes', + author_email = 'bran...@rhodesmill.org', + url = 'http://rhodesmill.org/pyephem/', + classifiers = [ + 'Development Status :: 6 - Mature', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved ::' + ' GNU Library or Lesser General Public License (LGPL)', + 'Topic :: Scientific/Engineering :: Astronomy', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + ], + install_requires=['ephem==' + version], +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyephem-3.7.7.0/setup.py new/pyephem-3.7.7.1/setup.py --- old/pyephem-3.7.7.0/setup.py 2019-08-18 13:03:34.000000000 +0200 +++ new/pyephem-3.7.7.1/setup.py 2020-02-22 23:21:45.000000000 +0100 @@ -55,6 +55,10 @@ 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], packages = [ 'ephem', 'ephem.tests' ], package_data = { 'ephem': ['doc/*.rst',