File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1616# You should have received a copy of the GNU Affero General Public License
1717# along with this program. If not, see <https://www.gnu.org/licenses/>.
1818
19+ from core import alert_deprecation
20+ from sys import version_info
21+
22+ python_version = (version_info .major , version_info .minor )
23+ msg_python = (
24+ '\n On Python 3.7, you can also use the "importlib-metadata" package.'
25+ if python_version == (3 , 7 )
26+ else ""
27+ )
28+
29+ alert_deprecation (
30+ 'Module "kosmorrolib.__version__" is deprecated since version 1.1. '
31+ "Use the importlib.metadata module provided by Python 3.8+: "
32+ "https://docs.python.org/3/library/importlib.metadata.html." + msg_python
33+ )
34+
1935__title__ = "kosmorrolib"
2036__description__ = "A library to compute your ephemerides"
2137__url__ = "http://kosmorro.space/lib"
Original file line number Diff line number Diff line change @@ -51,10 +51,19 @@ def flatten_list(the_list: list):
5151 return new_list
5252
5353
54+ def alert_deprecation (message ):
55+ """Show the given message as a deprecation warning.
56+
57+ >>> alert_deprecation("This is deprecated.")
58+ sys:1: DeprecationWarning: This is deprecated.
59+ """
60+ warn (message , DeprecationWarning , stacklevel = 2 )
61+
62+
5463def deprecated (message ):
5564 def inner (decorated ):
5665 def f (* args , ** kwargs ):
57- warn (message , DeprecationWarning , stacklevel = 2 )
66+ alert_deprecation (message )
5867 return decorated (* args , ** kwargs )
5968
6069 return f
You can’t perform that action at this time.
0 commit comments