We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
External pull requests currently fail the deploy task
The build on #536 is currently failing because the decryption is trying to run and it doesn't have access to the decryption environment variables because it comes from @Zac-HD's fork rather than the main repo.

The solution is just to have that task skip for external pull requests I think.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scripts/deploy.py`
Content:
```
1 #!/usr/bin/env python
2 
3 # coding=utf-8
4 #
5 # This file is part of Hypothesis, which may be found at
6 # https://github.com/HypothesisWorks/hypothesis-python
7 #
8 # Most of this work is copyright (C) 2013-2017 David R. MacIver
9 # (david@drmaciver.com), but it contains contributions by others. See
10 # CONTRIBUTING.rst for a full list of people who may hold copyright, and
11 # consult the git log if you need to determine who owns an individual
12 # contribution.
13 #
14 # This Source Code Form is subject to the terms of the Mozilla Public License,
15 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
16 # obtain one at http://mozilla.org/MPL/2.0/.
17 #
18 # END HEADER
19 
20 from __future__ import division, print_function, absolute_import
21 
22 import os
23 import sys
24 import random
25 import shutil
26 import subprocess
27 from time import time, sleep
28 
29 import hypothesistooling as tools
30 
31 sys.path.append(os.path.dirname(__file__))  # noqa
32 
33 
34 DIST = os.path.join(tools.ROOT, 'dist')
35 
36 
37 PENDING_STATUS = ('started', 'created')
38 
39 
40 if __name__ == '__main__':
41 
42     print('Decrypting secrets')
43 
44     # We'd normally avoid the use of shell=True, but this is more or less
45     # intended as an opaque string that was given to us by Travis that happens
46     # to be a shell command that we run, and there are a number of good reasons
47     # this particular instance is harmless and would be high effort to
48     # convert (principally: Lack of programmatic generation of the string and
49     # extensive use of environment variables in it), so we're making an
50     # exception here.
51     subprocess.check_call(
52         'openssl aes-256-cbc -K $encrypted_39cb4cc39a80_key '
53         '-iv $encrypted_39cb4cc39a80_iv -in secrets.tar.enc '
54         '-out secrets.tar -d',
55         shell=True
56     )
57 
58     subprocess.check_call([
59         'tar', '-xvf', 'secrets.tar',
60     ])
61 
62     last_release = tools.latest_version()
63 
64     print('Current version: %s. Latest released version: %s' % (
65         tools.__version__, last_release
66     ))
67 
68     print('Building an sdist...')
69 
70     if os.path.exists(DIST):
71         shutil.rmtree(DIST)
72 
73     subprocess.check_output([
74         sys.executable, 'setup.py', 'sdist', '--dist-dir', DIST,
75     ])
76 
77     if not tools.on_master():
78         print('Not deploying due to not being on master')
79         sys.exit(0)
80 
81     if not tools.has_source_changes(last_release):
82         print('Not deploying due to no source changes')
83         sys.exit(0)
84 
85     start_time = time()
86 
87     prev_pending = None
88 
89     # We time out after an hour, which is a stupidly long time and it should
90     # never actually take that long: A full Travis run only takes about 20-30
91     # minutes! This is really just here as a guard in case something goes
92     # wrong and we're not paying attention so as to not be too mean to Travis..
93     while time() <= start_time + 60 * 60:
94         jobs = tools.build_jobs()
95 
96         failed_jobs = [
97             (k, v)
98             for k, vs in jobs.items()
99             if k not in PENDING_STATUS + ('passed',)
100             for v in vs
101         ]
102 
103         if failed_jobs:
104             print('Failing this due to failure of jobs %s' % (
105                 ', '.join('%s(%s)' % (s, j) for j, s in failed_jobs),
106             ))
107             sys.exit(1)
108         else:
109             pending = [j for s in PENDING_STATUS for j in jobs.get(s, ())]
110             try:
111                 # This allows us to test the deploy job for a build locally.
112                 pending.remove('deploy')
113             except ValueError:
114                 pass
115             if pending:
116                 still_pending = set(pending)
117                 if prev_pending is None:
118                     print('Waiting for the following jobs to complete:')
119                     for p in sorted(still_pending):
120                         print(' * %s' % (p,))
121                     print()
122                 else:
123                     completed = prev_pending - still_pending
124                     if completed:
125                         print('%s completed since last check.' % (
126                             ', '.join(sorted(completed)),))
127                 prev_pending = still_pending
128                 naptime = 10.0 * (2 + random.random())
129                 print('Waiting %.2fs for %d more job%s to complete' % (
130                     naptime, len(pending), 's' if len(pending) > 1 else '',))
131                 sleep(naptime)
132             else:
133                 break
134     else:
135         print("We've been waiting for an hour. That seems bad. Failing now.")
136         sys.exit(1)
137 
138     print('Looks good to release!')
139     print('Now uploading to pypi.')
140 
141     subprocess.check_output([
142         sys.executable, '-m', 'twine', 'upload',
143         '--config-file', './.pypirc',
144         os.path.join(DIST, '*'),
145     ])
146 
147     print('Release seems good. Pushing the tag now.')
148 
149     tools.create_tag()
150     sys.exit(0)
151
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scripts/deploy.py b/scripts/deploy.py
--- a/scripts/deploy.py
+++ b/scripts/deploy.py
@@ -38,6 +38,8 @@
 
 
 if __name__ == '__main__':
+    if os.environ.get('TRAVIS_SECURE_ENV_VARS', None) != 'true':
+        sys.exit(0)
 
     print('Decrypting secrets')

{"golden_diff": "diff --git a/scripts/deploy.py b/scripts/deploy.py\n--- a/scripts/deploy.py\n+++ b/scripts/deploy.py\n@@ -38,6 +38,8 @@\n \n \n if __name__ == '__main__':\n+    if os.environ.get('TRAVIS_SECURE_ENV_VARS', None) != 'true':\n+        sys.exit(0)\n \n     print('Decrypting secrets')\n", "issue": "External pull requests currently fail the deploy task\nThe build on #536 is currently failing because the decryption is trying to run and it doesn't have access to the decryption environment variables because it comes from @Zac-HD's fork rather than the main repo.\r\n\r\nThe solution is just to have that task skip for external pull requests I think.\n", "before_files": [{"content": "#!/usr/bin/env python\n\n# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\nimport os\nimport sys\nimport random\nimport shutil\nimport subprocess\nfrom time import time, sleep\n\nimport hypothesistooling as tools\n\nsys.path.append(os.path.dirname(__file__))  # noqa\n\n\nDIST = os.path.join(tools.ROOT, 'dist')\n\n\nPENDING_STATUS = ('started', 'created')\n\n\nif __name__ == '__main__':\n\n    print('Decrypting secrets')\n\n    # We'd normally avoid the use of shell=True, but this is more or less\n    # intended as an opaque string that was given to us by Travis that happens\n    # to be a shell command that we run, and there are a number of good reasons\n    # this particular instance is harmless and would be high effort to\n    # convert (principally: Lack of programmatic generation of the string and\n    # extensive use of environment variables in it), so we're making an\n    # exception here.\n    subprocess.check_call(\n        'openssl aes-256-cbc -K $encrypted_39cb4cc39a80_key '\n        '-iv $encrypted_39cb4cc39a80_iv -in secrets.tar.enc '\n        '-out secrets.tar -d',\n        shell=True\n    )\n\n    subprocess.check_call([\n        'tar', '-xvf', 'secrets.tar',\n    ])\n\n    last_release = tools.latest_version()\n\n    print('Current version: %s. Latest released version: %s' % (\n        tools.__version__, last_release\n    ))\n\n    print('Building an sdist...')\n\n    if os.path.exists(DIST):\n        shutil.rmtree(DIST)\n\n    subprocess.check_output([\n        sys.executable, 'setup.py', 'sdist', '--dist-dir', DIST,\n    ])\n\n    if not tools.on_master():\n        print('Not deploying due to not being on master')\n        sys.exit(0)\n\n    if not tools.has_source_changes(last_release):\n        print('Not deploying due to no source changes')\n        sys.exit(0)\n\n    start_time = time()\n\n    prev_pending = None\n\n    # We time out after an hour, which is a stupidly long time and it should\n    # never actually take that long: A full Travis run only takes about 20-30\n    # minutes! This is really just here as a guard in case something goes\n    # wrong and we're not paying attention so as to not be too mean to Travis..\n    while time() <= start_time + 60 * 60:\n        jobs = tools.build_jobs()\n\n        failed_jobs = [\n            (k, v)\n            for k, vs in jobs.items()\n            if k not in PENDING_STATUS + ('passed',)\n            for v in vs\n        ]\n\n        if failed_jobs:\n            print('Failing this due to failure of jobs %s' % (\n                ', '.join('%s(%s)' % (s, j) for j, s in failed_jobs),\n            ))\n            sys.exit(1)\n        else:\n            pending = [j for s in PENDING_STATUS for j in jobs.get(s, ())]\n            try:\n                # This allows us to test the deploy job for a build locally.\n                pending.remove('deploy')\n            except ValueError:\n                pass\n            if pending:\n                still_pending = set(pending)\n                if prev_pending is None:\n                    print('Waiting for the following jobs to complete:')\n                    for p in sorted(still_pending):\n                        print(' * %s' % (p,))\n                    print()\n                else:\n                    completed = prev_pending - still_pending\n                    if completed:\n                        print('%s completed since last check.' % (\n                            ', '.join(sorted(completed)),))\n                prev_pending = still_pending\n                naptime = 10.0 * (2 + random.random())\n                print('Waiting %.2fs for %d more job%s to complete' % (\n                    naptime, len(pending), 's' if len(pending) > 1 else '',))\n                sleep(naptime)\n            else:\n                break\n    else:\n        print(\"We've been waiting for an hour. That seems bad. Failing now.\")\n        sys.exit(1)\n\n    print('Looks good to release!')\n    print('Now uploading to pypi.')\n\n    subprocess.check_output([\n        sys.executable, '-m', 'twine', 'upload',\n        '--config-file', './.pypirc',\n        os.path.join(DIST, '*'),\n    ])\n\n    print('Release seems good. Pushing the tag now.')\n\n    tools.create_tag()\n    sys.exit(0)\n", "path": "scripts/deploy.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\nimport os\nimport sys\nimport random\nimport shutil\nimport subprocess\nfrom time import time, sleep\n\nimport hypothesistooling as tools\n\nsys.path.append(os.path.dirname(__file__))  # noqa\n\n\nDIST = os.path.join(tools.ROOT, 'dist')\n\n\nPENDING_STATUS = ('started', 'created')\n\n\nif __name__ == '__main__':\n    if os.environ.get('TRAVIS_SECURE_ENV_VARS', None) != 'true':\n        sys.exit(0)\n\n    print('Decrypting secrets')\n\n    # We'd normally avoid the use of shell=True, but this is more or less\n    # intended as an opaque string that was given to us by Travis that happens\n    # to be a shell command that we run, and there are a number of good reasons\n    # this particular instance is harmless and would be high effort to\n    # convert (principally: Lack of programmatic generation of the string and\n    # extensive use of environment variables in it), so we're making an\n    # exception here.\n    subprocess.check_call(\n        'openssl aes-256-cbc -K $encrypted_39cb4cc39a80_key '\n        '-iv $encrypted_39cb4cc39a80_iv -in secrets.tar.enc '\n        '-out secrets.tar -d',\n        shell=True\n    )\n\n    subprocess.check_call([\n        'tar', '-xvf', 'secrets.tar',\n    ])\n\n    last_release = tools.latest_version()\n\n    print('Current version: %s. Latest released version: %s' % (\n        tools.__version__, last_release\n    ))\n\n    print('Building an sdist...')\n\n    if os.path.exists(DIST):\n        shutil.rmtree(DIST)\n\n    subprocess.check_output([\n        sys.executable, 'setup.py', 'sdist', '--dist-dir', DIST,\n    ])\n\n    if not tools.on_master():\n        print('Not deploying due to not being on master')\n        sys.exit(0)\n\n    if not tools.has_source_changes(last_release):\n        print('Not deploying due to no source changes')\n        sys.exit(0)\n\n    start_time = time()\n\n    prev_pending = None\n\n    # We time out after an hour, which is a stupidly long time and it should\n    # never actually take that long: A full Travis run only takes about 20-30\n    # minutes! This is really just here as a guard in case something goes\n    # wrong and we're not paying attention so as to not be too mean to Travis..\n    while time() <= start_time + 60 * 60:\n        jobs = tools.build_jobs()\n\n        failed_jobs = [\n            (k, v)\n            for k, vs in jobs.items()\n            if k not in PENDING_STATUS + ('passed',)\n            for v in vs\n        ]\n\n        if failed_jobs:\n            print('Failing this due to failure of jobs %s' % (\n                ', '.join('%s(%s)' % (s, j) for j, s in failed_jobs),\n            ))\n            sys.exit(1)\n        else:\n            pending = [j for s in PENDING_STATUS for j in jobs.get(s, ())]\n            try:\n                # This allows us to test the deploy job for a build locally.\n                pending.remove('deploy')\n            except ValueError:\n                pass\n            if pending:\n                still_pending = set(pending)\n                if prev_pending is None:\n                    print('Waiting for the following jobs to complete:')\n                    for p in sorted(still_pending):\n                        print(' * %s' % (p,))\n                    print()\n                else:\n                    completed = prev_pending - still_pending\n                    if completed:\n                        print('%s completed since last check.' % (\n                            ', '.join(sorted(completed)),))\n                prev_pending = still_pending\n                naptime = 10.0 * (2 + random.random())\n                print('Waiting %.2fs for %d more job%s to complete' % (\n                    naptime, len(pending), 's' if len(pending) > 1 else '',))\n                sleep(naptime)\n            else:\n                break\n    else:\n        print(\"We've been waiting for an hour. That seems bad. Failing now.\")\n        sys.exit(1)\n\n    print('Looks good to release!')\n    print('Now uploading to pypi.')\n\n    subprocess.check_output([\n        sys.executable, '-m', 'twine', 'upload',\n        '--config-file', './.pypirc',\n        os.path.join(DIST, '*'),\n    ])\n\n    print('Release seems good. Pushing the tag now.')\n\n    tools.create_tag()\n    sys.exit(0)\n", "path": "scripts/deploy.py"}]}