offlate/guix.scm

guix.scm

1
(use-modules
2
  ((guix licenses) #:prefix license:)
3
  (guix build-system python)
4
  (guix download)
5
  (guix git-download)
6
  (guix git)
7
  (guix packages)
8
  (guix utils)
9
  (gnu packages aspell)
10
  (gnu packages check)
11
  (gnu packages enchant)
12
  (gnu packages fontutils)
13
  (gnu packages freedesktop)
14
  (gnu packages libreoffice)
15
  (gnu packages python)
16
  (gnu packages python-web)
17
  (gnu packages python-xyz)
18
  (gnu packages qt)
19
  (gnu packages serialization)
20
  (gnu packages sphinx)
21
  (gnu packages time)
22
  (gnu packages version-control)
23
  (gnu packages xml))
24
25
(define my-python-android-stringslib
26
  (package
27
    (inherit python-android-stringslib)
28
    (source (origin
29
              (method git-fetch)
30
              (uri (git-reference
31
                     (url "https://framagit.org/tyreunom/python-android-strings-lib")
32
                     (commit "bea536ba7878ac1b569af45bffa2e4396bf134dc")))
33
              (file-name (git-file-name "python-android-stringslib" "1.2"))
34
              (sha256
35
               (base32
36
                "01adzm17cs5980f7d2222lpgdar5n99chyap7541aa4wc6gm9wqs"))))))
37
38
(define python-lxml-4.6
39
  (package
40
    (inherit python-lxml)
41
    (version "4.6.4")
42
    (source
43
      (origin
44
        (method url-fetch)
45
        (uri (pypi-uri "lxml" version))
46
        (sha256
47
          (base32 "171rs6w8rj5nfg3zzcwgllz6i3csw1ci0glbjajwgw9ixqgvvyfs"))))))
48
49
(define-public offlate
50
  (package
51
    (name "offlate")
52
    (version "0.5")
53
    (source (git-checkout (url (dirname (current-filename)))))
54
    (build-system python-build-system)
55
    (arguments
56
     `(#:modules ((guix build python-build-system)
57
                  (guix build qt-utils)
58
                  (guix build utils))
59
       #:imported-modules (,@%python-build-system-modules
60
                            (guix build qt-utils))
61
       ;; No tests
62
       #:tests? #f
63
       #:phases
64
       (modify-phases %standard-phases
65
         (add-before 'build 'generate-fonts
66
           (lambda _
67
             (invoke "make" "fonts")))
68
         (add-before 'build 'generate-translations
69
           (lambda _
70
             (invoke "make" "update-langs")))
71
         (add-after 'install 'wrap-qt
72
           (lambda* (#:key inputs outputs #:allow-other-keys)
73
             (let ((out (assoc-ref outputs "out")))
74
               (wrap-qt-program "offlate" #:output out #:inputs inputs))))
75
         (add-after 'install 'wrap-offlate
76
            (lambda* (#:key outputs #:allow-other-keys)
77
              (wrap-program
78
                  (string-append (assoc-ref outputs "out") "/bin/offlate")
79
                `("PYTHONPATH" ":" prefix
80
                  (,(string-append (getenv "PYTHONPATH") ":"
81
                   (assoc-ref outputs "out") "/lib/python"
82
                   ,(version-major+minor (package-version python-wrapper))
83
                   "/site-packages")))))))))
84
    (inputs
85
      `(("python-android-stringslib" ,my-python-android-stringslib)
86
        ("python-dateutil" ,python-dateutil)
87
        ("python-gitlab" ,python-gitlab)
88
        ("python-lxml" ,python-lxml-4.6)
89
        ("python-polib" ,python-polib)
90
        ("python-pycountry" ,python-pycountry)
91
        ("python-pyenchant" ,python-pyenchant)
92
        ("python-pygit2" ,python-pygit2)
93
        ("python-pygithub" ,python-pygithub)
94
        ("python-pyqt" ,python-pyqt)
95
        ("python-requests" ,python-requests)
96
        ("python-ruamel.yaml" ,python-ruamel.yaml)
97
        ("python-translate-toolkit" ,python-translate-toolkit)
98
        ("python-translation-finder" ,python-translation-finder)
99
        ("python-watchdog" ,python-watchdog)))
100
    (native-inputs
101
     `(("fontforge" ,fontforge)
102
       ("qttools" ,qttools)
103
       ("python-sphinx" ,python-sphinx)))
104
    (home-page "https://framagit.org/tyreunom/offlate")
105
    (synopsis "Offline translation interface for online translation tools")
106
    (description "Offlate offers a unified interface for different translation
107
file formats, as well as many different online translation platforms.  You can
108
use it to get work from online platforms, specialized such as the Translation
109
Project, or not such a gitlab instance when your upstream doesn't use any
110
dedicated platform.  The tool proposes a unified interface for any format and
111
an upload option to send your work back to the platform.")
112
    (license license:gpl3+)))
113
114
offlate
115