Skip to content

Commit

Permalink
requirements: Upgrade talon fork to 1.4.8.
Browse files Browse the repository at this point in the history
mailgun/talon#200

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Mar 12, 2021
1 parent a556abb commit 68e0a32
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 27 deletions.
4 changes: 2 additions & 2 deletions requirements/common.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ python-gcm

# Needed for the email mirror
html2text
# Forked to avoid pulling in scipy: https://github.com/mailgun/talon/issues/130
https://github.com/zulip/talon/archive/7d8bdc4dbcfcc5a73298747293b99fe53da55315.zip#egg=talon==1.2.10.zulip1
# Forked to avoid pulling in scipy: https://github.com/mailgun/talon/pull/200
https://github.com/zulip/talon/archive/1711705c952806d4a704c7dbf58f21db8e11756a.zip#egg=talon-core==1.4.8.zulip1&subdirectory=talon-core

# Needed for inlining the CSS in emails
premailer
Expand Down
22 changes: 14 additions & 8 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ cchardet==2.1.7 \
--hash=sha256:f16517f3697569822c6d09671217fdeab61dfebc7acb5068634d6b0728b86c0b \
--hash=sha256:f86e0566cb61dc4397297696a4a1b30f6391b50bc52b4f073507a48466b6255a \
--hash=sha256:fdac1e4366d0579fff056d1280b8dc6348be964fda8ebb627c0269e097ab37fa
# via talon
# via talon-core
certifi==2020.12.5 \
--hash=sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c \
--hash=sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830
Expand Down Expand Up @@ -197,7 +197,7 @@ chardet==4.0.0 \
# via
# python-debian
# requests
# talon
# talon-core
click==7.1.2 \
--hash=sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a \
--hash=sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc
Expand Down Expand Up @@ -305,7 +305,7 @@ cssselect==1.1.0 \
# parsel
# premailer
# scrapy
# talon
# talon-core
cssutils==1.0.2 \
--hash=sha256:a2fcf06467553038e98fea9cfe36af2bf14063eb147a70958cfcaa8f5786acaf \
--hash=sha256:c74dbe19c92f5052774eadb15136263548dd013250f1ed1027988e7fef125c8d
Expand Down Expand Up @@ -427,6 +427,10 @@ html2text==2020.1.16 \
# via
# -r requirements/common.in
# zulip-bots
html5lib==1.1 \
--hash=sha256:0d78f8fde1c230e99fe37986a60526d7049ed4bf8a9fadbad5f00e22e58e041d \
--hash=sha256:b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f
# via talon-core
hyper==0.7.0 \
--hash=sha256:069514f54231fb7b5df2fb910a114663a83306d5296f588fffcb0a9be19407fc \
--hash=sha256:12c82eacd122a659673484c1ea0d34576430afbe5aa6b8f63fe37fcb06a2458c
Expand Down Expand Up @@ -694,7 +698,7 @@ lxml==4.6.2 \
# pyoembed
# python3-saml
# scrapy
# talon
# talon-core
# xmlsec
# zulip-bots
markdown-include==0.6.0 \
Expand Down Expand Up @@ -1243,7 +1247,7 @@ regex==2020.11.13 \
--hash=sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f
# via
# black
# talon
# talon-core
requests-oauthlib==1.3.0 \
--hash=sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d \
--hash=sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a
Expand Down Expand Up @@ -1346,6 +1350,7 @@ six==1.15.0 \
# argon2-cffi
# automat
# django-bitfield
# html5lib
# isodate
# jsonschema
# junit-xml
Expand All @@ -1364,7 +1369,7 @@ six==1.15.0 \
# responses
# social-auth-app-django
# social-auth-core
# talon
# talon-core
# traitlets
# twilio
# w3lib
Expand Down Expand Up @@ -1494,8 +1499,8 @@ tabulate==0.8.9 \
--hash=sha256:d7c013fe7abbc5e491394e10fa845f8f32fe54f8dc60c6622c6cf482d25d47e4 \
--hash=sha256:eb1d13f25760052e8931f2ef80aaf6045a6cceb47514db8beab24cded16f13a7
# via pyre-check
https://github.com/zulip/talon/archive/7d8bdc4dbcfcc5a73298747293b99fe53da55315.zip#egg=talon==1.2.10.zulip1 \
--hash=sha256:21d87c437379287d09df7a2d2af7bd818d4fa00be619dff446dacbdb4338d921
https://github.com/zulip/talon/archive/1711705c952806d4a704c7dbf58f21db8e11756a.zip#egg=talon-core==1.4.8.zulip1&subdirectory=talon-core \
--hash=sha256:e562269ba5f5d71f35f3dd7ee4c0c62a6c95dfb41984766eff645425c4dec71e
# via -r requirements/common.in
tblib==1.7.0 \
--hash=sha256:059bd77306ea7b419d4f76016aef6d7027cc8a0785579b5aad198803435f882c \
Expand Down Expand Up @@ -1632,6 +1637,7 @@ webencodings==0.5.1 \
--hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923
# via
# cssselect2
# html5lib
# tinycss2
werkzeug==1.0.1 \
--hash=sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43 \
Expand Down
25 changes: 17 additions & 8 deletions requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ cchardet==2.1.7 \
--hash=sha256:f16517f3697569822c6d09671217fdeab61dfebc7acb5068634d6b0728b86c0b \
--hash=sha256:f86e0566cb61dc4397297696a4a1b30f6391b50bc52b4f073507a48466b6255a \
--hash=sha256:fdac1e4366d0579fff056d1280b8dc6348be964fda8ebb627c0269e097ab37fa
# via talon
# via talon-core
certifi==2020.12.5 \
--hash=sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c \
--hash=sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830
Expand Down Expand Up @@ -156,7 +156,7 @@ chardet==4.0.0 \
--hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5
# via
# requests
# talon
# talon-core
cryptography==3.4.6 \
--hash=sha256:066bc53f052dfeda2f2d7c195cf16fb3e5ff13e1b6b7415b468514b40b381a5b \
--hash=sha256:0923ba600d00718d63a3976f23cab19aef10c1765038945628cd9be047ad0336 \
Expand All @@ -181,7 +181,7 @@ cssselect==1.1.0 \
--hash=sha256:f95f8dedd925fd8f54edb3d2dfb44c190d9d18512377d3c1e2388d16126879bc
# via
# premailer
# talon
# talon-core
cssutils==1.0.2 \
--hash=sha256:a2fcf06467553038e98fea9cfe36af2bf14063eb147a70958cfcaa8f5786acaf \
--hash=sha256:c74dbe19c92f5052774eadb15136263548dd013250f1ed1027988e7fef125c8d
Expand Down Expand Up @@ -279,6 +279,10 @@ html2text==2020.1.16 \
# via
# -r requirements/common.in
# zulip-bots
html5lib==1.1 \
--hash=sha256:0d78f8fde1c230e99fe37986a60526d7049ed4bf8a9fadbad5f00e22e58e041d \
--hash=sha256:b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f
# via talon-core
hyper==0.7.0 \
--hash=sha256:069514f54231fb7b5df2fb910a114663a83306d5296f588fffcb0a9be19407fc \
--hash=sha256:12c82eacd122a659673484c1ea0d34576430afbe5aa6b8f63fe37fcb06a2458c
Expand Down Expand Up @@ -481,7 +485,7 @@ lxml==4.6.2 \
# premailer
# pyoembed
# python3-saml
# talon
# talon-core
# xmlsec
# zulip-bots
markdown-include==0.6.0 \
Expand Down Expand Up @@ -854,7 +858,7 @@ regex==2020.11.13 \
--hash=sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d \
--hash=sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917 \
--hash=sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f
# via talon
# via talon-core
requests-oauthlib==1.3.0 \
--hash=sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d \
--hash=sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a
Expand Down Expand Up @@ -891,6 +895,7 @@ six==1.15.0 \
# via
# argon2-cffi
# django-bitfield
# html5lib
# isodate
# jsonschema
# libthumbor
Expand All @@ -903,7 +908,7 @@ six==1.15.0 \
# qrcode
# social-auth-app-django
# social-auth-core
# talon
# talon-core
# traitlets
# twilio
# zulip
Expand Down Expand Up @@ -978,8 +983,8 @@ stripe==2.56.0 \
--hash=sha256:2ff904fb8dee0d25f135059468a876852d24dc8cbe0b45d7aff56a028045777c \
--hash=sha256:6c685eeadf9e3608315b6d84b4f5f2da2909179b65633ce20f296be22ed21a98
# via -r requirements/common.in
https://github.com/zulip/talon/archive/7d8bdc4dbcfcc5a73298747293b99fe53da55315.zip#egg=talon==1.2.10.zulip1 \
--hash=sha256:21d87c437379287d09df7a2d2af7bd818d4fa00be619dff446dacbdb4338d921
https://github.com/zulip/talon/archive/1711705c952806d4a704c7dbf58f21db8e11756a.zip#egg=talon-core==1.4.8.zulip1&subdirectory=talon-core \
--hash=sha256:e562269ba5f5d71f35f3dd7ee4c0c62a6c95dfb41984766eff645425c4dec71e
# via -r requirements/common.in
tlds==2021030200 \
--hash=sha256:9125f332682e2686503d00642f9059069b440fe452511671bbe52848a7ccdcdb \
Expand Down Expand Up @@ -1027,6 +1032,10 @@ wcwidth==0.2.5 \
--hash=sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784 \
--hash=sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83
# via prompt-toolkit
webencodings==0.5.1 \
--hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \
--hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923
# via html5lib
werkzeug==1.0.1 \
--hash=sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43 \
--hash=sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c
Expand Down
4 changes: 2 additions & 2 deletions scripts/lib/setup_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"python3-dev", # Needed to install typed-ast dependency of mypy
"python3-pip",
"virtualenv",
"libxml2-dev", # Used for installing talon and python-xmlsec
"libxslt1-dev", # Used for installing talon
"libxml2-dev", # Used for installing talon-core and python-xmlsec
"libxslt1-dev", # Used for installing talon-core
"libpq-dev", # Needed by psycopg2
"libssl-dev", # Needed to build pycurl and other libraries
"libmagic1", # Used for install python-magic
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
# historical commits sharing the same major version, in which case a
# minor version bump suffices.

PROVISION_VERSION = "133.0"
PROVISION_VERSION = "134.0"
12 changes: 6 additions & 6 deletions zerver/lib/email_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,37 +257,37 @@ def extract_body(


def extract_plaintext_body(message: EmailMessage, include_quotes: bool = False) -> Optional[str]:
import talon
import talon_core

global talon_initialized
if not talon_initialized:
talon.init()
talon_core.init()
talon_initialized = True

plaintext_content = get_message_part_by_type(message, "text/plain")
if plaintext_content is not None:
if include_quotes:
return plaintext_content
else:
return talon.quotations.extract_from_plain(plaintext_content)
return talon_core.quotations.extract_from_plain(plaintext_content)
else:
return None


def extract_html_body(message: EmailMessage, include_quotes: bool = False) -> Optional[str]:
import talon
import talon_core

global talon_initialized
if not talon_initialized: # nocoverage
talon.init()
talon_core.init()
talon_initialized = True

html_content = get_message_part_by_type(message, "text/html")
if html_content is not None:
if include_quotes:
return convert_html_to_markdown(html_content)
else:
return convert_html_to_markdown(talon.quotations.extract_from_html(html_content))
return convert_html_to_markdown(talon_core.quotations.extract_from_html(html_content))
else:
return None

Expand Down

0 comments on commit 68e0a32

Please sign in to comment.