2022-05-17 23:14:52 +02:00
|
|
|
(define-module (guix)
|
2022-05-26 22:46:59 +02:00
|
|
|
#:use-module (guix git-download)
|
|
|
|
#:use-module (guix build-system python)
|
2022-07-26 22:23:47 +02:00
|
|
|
#:use-module (guix gexp)
|
2022-05-26 22:46:59 +02:00
|
|
|
#:use-module (guix packages)
|
2022-07-26 22:23:47 +02:00
|
|
|
#:use-module (gnu packages base) ;; for tar
|
|
|
|
#:use-module (gnu packages bash) ;; for bash
|
|
|
|
#:use-module (gnu packages compression) ;; for gzip
|
|
|
|
#:use-module (gnu packages databases) ;; for python-tortoise-orm
|
2022-05-26 22:46:59 +02:00
|
|
|
#:use-module (gnu packages python)
|
2022-07-26 22:23:47 +02:00
|
|
|
#:use-module (gnu packages python-web) ;; for python-tweepy
|
|
|
|
#:use-module (gnu packages python-xyz) ;; for dynaconf
|
2022-05-26 22:46:59 +02:00
|
|
|
#:use-module (mobilizon-reshare package)
|
|
|
|
#:use-module (mobilizon-reshare dependencies)
|
|
|
|
#:use-module (ice-9 rdelim)
|
|
|
|
#:use-module (ice-9 popen))
|
|
|
|
|
|
|
|
(define %source-dir (getcwd))
|
|
|
|
|
2022-07-26 22:23:47 +02:00
|
|
|
(define mobilizon-reshare-git-origin
|
|
|
|
(local-file %source-dir
|
|
|
|
#:recursive? #t
|
|
|
|
#:select? (git-predicate %source-dir)))
|
|
|
|
|
|
|
|
(define mobilizon-reshare-git-origin-with-setup.py
|
|
|
|
(computed-file "source"
|
|
|
|
(with-imported-modules '((guix build utils)
|
|
|
|
(ice-9 string-fun))
|
|
|
|
#~(begin
|
|
|
|
(let ((bash (string-append #$bash "/bin/bash"))
|
|
|
|
(gzip (string-append #$gzip "/bin/gzip"))
|
|
|
|
(poetry (string-append #$poetry "/bin/poetry"))
|
|
|
|
(sed (string-append #$sed "/bin/sed"))
|
|
|
|
(tar (string-append #$tar "/bin/tar"))
|
|
|
|
(tests-script "./scripts/run_pipeline_tests.sh")
|
|
|
|
(origin #$mobilizon-reshare-git-origin))
|
|
|
|
(use-modules (guix build utils)
|
|
|
|
(ice-9 string-fun))
|
|
|
|
(copy-recursively origin ".")
|
|
|
|
;; This is an hack to obtain poetry's setup.py.
|
|
|
|
(setenv "POETRY_VIRTUALENVS_CREATE" "false")
|
|
|
|
(invoke poetry "build" "-f" "sdist")
|
|
|
|
(invoke bash "-c"
|
|
|
|
(string-append "cd dist && "
|
|
|
|
gzip " -cd ./*-`" poetry " version -s`.tar.gz > out.tar"))
|
|
|
|
(invoke bash "-c"
|
|
|
|
(string-append
|
|
|
|
tar " --wildcards -xvf dist/out.tar -O '*/setup.py' > setup.py"))
|
|
|
|
;; Reduce source size.
|
|
|
|
(delete-file-recursively "dist")
|
|
|
|
(invoke sed "-i" "-E" (string-append "s/poetry/" (string-replace-substring poetry "/" "\\/") "/") tests-script)
|
|
|
|
(copy-recursively "." #$output))))))
|
|
|
|
|
2022-05-26 22:46:59 +02:00
|
|
|
(define-public mobilizon-reshare.git
|
|
|
|
(let ((source-version (with-input-from-file
|
|
|
|
(string-append %source-dir
|
|
|
|
"/mobilizon_reshare/VERSION")
|
|
|
|
read-line))
|
|
|
|
(revision "0")
|
|
|
|
(commit (read-line
|
|
|
|
(open-input-pipe "git show HEAD | head -1 | cut -d ' ' -f 2"))))
|
|
|
|
(package (inherit mobilizon-reshare)
|
|
|
|
(name "mobilizon-reshare.git")
|
|
|
|
(version (git-version source-version revision commit))
|
2022-07-26 22:23:47 +02:00
|
|
|
(source mobilizon-reshare-git-origin-with-setup.py)
|
2022-05-26 22:46:59 +02:00
|
|
|
(propagated-inputs
|
|
|
|
(modify-inputs (package-propagated-inputs mobilizon-reshare)
|
2022-07-26 22:23:47 +02:00
|
|
|
(replace "python-aerich"
|
|
|
|
python-aerich)
|
|
|
|
(replace "python-click"
|
|
|
|
python-click)
|
|
|
|
(replace "dynaconf"
|
|
|
|
dynaconf)
|
|
|
|
(replace "python-facebook-sdk"
|
|
|
|
python-facebook-sdk)
|
|
|
|
(replace "python-requests"
|
|
|
|
python-requests)
|
|
|
|
(replace "python-tweepy"
|
|
|
|
python-tweepy)
|
|
|
|
(replace "python-tortoise-orm"
|
|
|
|
python-tortoise-orm))))))
|
2022-05-26 22:46:59 +02:00
|
|
|
|
|
|
|
(define-public mobilizon-reshare-scheduler
|
|
|
|
(package (inherit mobilizon-reshare.git)
|
|
|
|
(name "mobilizon-reshare-scheduler")
|
|
|
|
(build-system python-build-system)
|
|
|
|
(arguments
|
2022-07-26 22:23:47 +02:00
|
|
|
(list
|
|
|
|
#:phases
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
(delete 'configure)
|
|
|
|
(delete 'build)
|
|
|
|
(delete 'check)
|
|
|
|
(replace 'install
|
|
|
|
(lambda _
|
|
|
|
(let ((bin (string-append #$output "/bin")))
|
|
|
|
(mkdir-p bin)
|
|
|
|
(install-file "scripts/scheduler.py" bin)))))))
|
2022-05-26 22:46:59 +02:00
|
|
|
(propagated-inputs (list mobilizon-reshare.git
|
|
|
|
python-apscheduler))
|
|
|
|
(synopsis "Mobilizon Reshare's scheduler")
|
|
|
|
(description "This script is intended to start a scheduler
|
|
|
|
running @code{mobilizon-reshare}.")))
|
|
|
|
|
2021-10-31 01:55:25 +02:00
|
|
|
mobilizon-reshare.git
|