Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ jobs:
fail-fast: false
matrix:
package:
- skyfield-data
- kosmorrolib
- kosmorro
- pypi: skyfield-data
recipe: python3-skyfield-data
- pypi: kosmorrolib
recipe: python3-kosmorrolib
- pypi: kosmorro
recipe: kosmorro
type:
- deb
name: "${{ matrix.package }} (${{ matrix.type }})"

name: "${{ matrix.package.pypi }} (${{ matrix.type }})"
steps:
- uses: actions/checkout@v5

Expand All @@ -28,12 +31,12 @@ jobs:
python-version: "3.x"

- run: |
pip install ${{ matrix.package }}
pip install ${{ matrix.package.pypi }}

- run: |
sudo apt update
sudo apt install dpkg fakeroot lintian
- run: make ${{ matrix.package }}.deb
sudo apt install ronn dpkg fakeroot lintian

- run: make ${{ matrix.package.recipe }}.deb

- run: lintian -i ${{ matrix.package }}_*.deb
- run: lintian -i ${{ matrix.package.recipe }}_*.deb
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,48 @@ clean:
#######################

.PHONY: deb
deb: skyfield-data.deb kosmorrolib.deb kosmorro.deb
deb: python3-skyfield-data.deb python3-kosmorrolib.deb kosmorro.deb

skyfield-data.deb:
python3-skyfield-data.deb:
mkdir -p skyfield-data-deb/DEBIAN
mkdir -p skyfield-data-deb/usr/bin
mkdir -p skyfield-data-deb/usr/share/doc/python3-skyfield-data
mkdir -p skyfield-data-deb/usr/lib/python3/dist-packages

pip install --target=tmp skyfield-data
rm -rf tmp/skyfield_data/__pycache__

cp -r tmp/skyfield_data skyfield-data-deb/usr/lib/python3/dist-packages
cp -r tmp/skyfield_data-$(SKYFIELD_DATA_VERSION).dist-info skyfield-data-deb/usr/lib/python3/dist-packages
cp deb/skyfield-data/control skyfield-data-deb/DEBIAN/control

curl https://raw.githubusercontent.com/brunobord/skyfield-data/refs/tags/$(SKYFIELD_DATA_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-skyfield-data Deuchnord "jerome@deuchnord.fr" | gzip -9 > skyfield-data-deb/usr/share/doc/python3-skyfield-data/changelog.gz
curl https://raw.githubusercontent.com/brunobord/skyfield-data/refs/tags/$(SKYFIELD_DATA_VERSION)/COPYING > skyfield-data-deb/usr/share/doc/python3-skyfield-data/copyright

sed -i "s/Version: __VERSION__/Version: $(SKYFIELD_DATA_VERSION)/" skyfield-data-deb/DEBIAN/control

fakeroot dpkg-deb --build skyfield-data-deb
mv skyfield-data-deb.deb python3-skyfield-data_$(SKYFIELD_DATA_VERSION)_all.deb

rm -rf skyfield-data-deb tmp

kosmorrolib.deb:
python3-kosmorrolib.deb:
mkdir -p kosmorrolib-deb/DEBIAN
mkdir -p kosmorrolib-deb/usr/bin
mkdir -p kosmorrolib-deb/usr/share/doc/python3-kosmorrolib
mkdir -p kosmorrolib-deb/usr/lib/python3/dist-packages

pip install --target=tmp kosmorrolib
rm -rf tmp/kosmorrolib/__pycache__

cp -r tmp/kosmorrolib kosmorrolib-deb/usr/lib/python3/dist-packages
cp -r tmp/kosmorrolib-$(KOSMORROLIB_VERSION).dist-info kosmorrolib-deb/usr/lib/python3/dist-packages
cp deb/kosmorrolib/control kosmorrolib-deb/DEBIAN/control

curl https://raw.githubusercontent.com/Kosmorro/lib/refs/tags/v$(KOSMORROLIB_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-kosmorrolib Deuchnord "jerome@deuchnord.fr" | gzip -9 > kosmorrolib-deb/usr/share/doc/python3-kosmorrolib/changelog.gz
curl https://raw.githubusercontent.com/Kosmorro/lib/refs/tags/v$(KOSMORROLIB_VERSION)/LICENSE.md > kosmorrolib-deb/usr/share/doc/python3-kosmorrolib/copyright


sed -i "s/Version: __VERSION__/Version: $(KOSMORROLIB_VERSION)/" kosmorrolib-deb/DEBIAN/control

fakeroot dpkg-deb --build kosmorrolib-deb
Expand All @@ -54,13 +65,21 @@ kosmorrolib.deb:
kosmorro.deb:
mkdir -p kosmorro-deb/DEBIAN
mkdir -p kosmorro-deb/usr/bin
mkdir -p kosmorro-deb/usr/share/doc/kosmorro
mkdir -p kosmorro-deb/usr/share/man/man1
mkdir -p kosmorro-deb/usr/lib/python3/dist-packages

pip install --target=tmp kosmorro
rm -rf tmp/kosmorro/__pycache__ tmp/kosmorro/i18n/__pycache__

cp -r tmp/kosmorro kosmorro-deb/usr/lib/python3/dist-packages
cp -r tmp/kosmorro-$(KOSMORRO_VERSION).dist-info kosmorro-deb/usr/lib/python3/dist-packages
cp tmp/bin/kosmorro kosmorro-deb/usr/bin/kosmorro

curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/manpage/kosmorro.1.md | ronn --roff | gzip -9 > kosmorro-deb/usr/share/man/man1/kosmorro.1.gz
curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-kosmorro Deuchnord "jerome@deuchnord.fr" | gzip -9 > kosmorro-deb/usr/share/doc/kosmorro/changelog.gz
curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/LICENSE.md > kosmorro-deb/usr/share/doc/kosmorro/copyright

cp deb/kosmorro/control kosmorro-deb/DEBIAN/control

chmod +x kosmorro-deb/usr/bin/kosmorro
Expand All @@ -71,4 +90,4 @@ kosmorro.deb:
fakeroot dpkg-deb --build kosmorro-deb
mv kosmorro-deb.deb kosmorro_$(KOSMORRO_VERSION)_all.deb

rm -rf kosmorro-deb tmp
rm -rf kosmorro-deb tmp
10 changes: 9 additions & 1 deletion deb/kosmorro/control
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
Package: kosmorro
Homepage: https://kosmorro.space
Version: __VERSION__
Section: science
Priority: optional
Architecture: all
Depends: python3, python3-kosmorrolib, python3-termcolor, python3-tabulate, python3-dateutil, python3-babel
Maintainer: Deuchnord <jerome@deuchnord.fr>
Description: A program to calculate the ephemerides
Description: Ephemerides calculation program
Kosmorro is a program that calculates your astronomical ephemerides.
It provides the following features:
- Calculate the rise, culmination and set times for any date and any position
on Earth
- Get informed about interesting astronomical events
- Generate a PDF with all the information needed for your observation nights
All calculations are made offline, no Internet connection needed.
11 changes: 10 additions & 1 deletion deb/kosmorrolib/control
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
Package: python3-kosmorrolib
Homepage: https://kosmorro.space/lib
Version: __VERSION__
Section: science
Priority: optional
Architecture: all
Depends: python3, python3-skyfield, python3-skyfield-data, python3-dateutil
Maintainer: Deuchnord <jerome@deuchnord.fr>
Description: A program to calculate the ephemerides
Description: Ephemerides calculation library
Kosmorrolib is a simple library that allows you to calculate astronomical
ephemerides.
It provides the following features:
- Calculate the rise, culmination and set times for any date and any position
on Earth
- Get informed about interesting astronomical events
- Generate a PDF with all the information needed for your observation nights
All calculations are made offline, no Internet connection needed.
52 changes: 52 additions & 0 deletions deb/mkchangelogs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import sys
import re
import datetime
import time
import textwrap

from argparse import ArgumentParser
from email import utils

def main() -> int:
args = ArgumentParser(description="Generate a Debian-compatible changelog from a Markdown changelog file")
args.add_argument("package", type=str)
args.add_argument("maintainer_name", type=str)
args.add_argument("maintainer_email", type=str)
args = args.parse_args()

started_list = False
change_lines = []
version = None
date = None

for line in sys.stdin:
markdown_line = line.strip()
if not started_list:
started_list = markdown_line.startswith(("* ", "- "))
if not started_list:
if version is None and date is None and markdown_line.startswith(("# ", "## ")):
m = re.findall(r"(\d+\.\d+\.\d+).*\((\d+-\d+-\d+)\)$", markdown_line)
if len(m) == 1:
version, date = m[0]
date = datetime.datetime.fromisoformat(date)
date = utils.formatdate(float(date.strftime("%s")), localtime=True)

continue

if not markdown_line.startswith(("* ", "- ")):
break

for l in textwrap.wrap(markdown_line, width=78):
change_lines.append(textwrap.indent(l, " "))

print(f"{args.package} ({version}) all; urgency=medium")
print()
print("\n".join(change_lines))
print()
print(f" -- {args.maintainer_name} <{args.maintainer_email}> {date}")

return 0


if __name__ == "__main__":
exit(main())
20 changes: 19 additions & 1 deletion deb/skyfield-data/control
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
Package: python3-skyfield-data
Homepage: https://pypi.org/project/skyfield-data
Version: __VERSION__
Section: science
Priority: optional
Architecture: all
Depends: python3
Maintainer: Deuchnord <jerome@deuchnord.fr>
Description: A program to calculate the ephemerides
Description: Minimal data files to work with python3-skyfield
Skyfield is a Python library for astronomical computations.
It depends on various data files to accurately compute moon phases, planet
positions, etc.
Several issues are raised by these data files:
- If they're not found in the path of the Loader, they're downloaded at
runtime. Depending on the archive you're requesting, some files might be
very large, causing a long delay (directly related to your network
bandwidth). In the case of a web server app, you'd cause a timeout on
client's end.
- They come mainly from 2 sources: NASA's JPL, and the IERS. If one of them
is temporarily unavailable, you couldn't perform any computation.
- In some countries, or behind some filtering proxies, some hosts may be
blocked.
- These files have an expiration date (in a more or less distant future). As
a consequence, even if the files are already downloaded in the right path,
at each runtime you could possibly have to download one or more files
before making any computation using them.