├── .gitignore ├── LICENSE-pythonw.txt ├── LICENSE.txt ├── MANIFEST.in ├── README.rst ├── install_pythonw ├── __init__.py └── pythonw.c └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | #### joe made this: https://goel.io/joe 2 | 3 | #####=== Python ===##### 4 | 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | 9 | # C extensions 10 | *.so 11 | 12 | # Distribution / packaging 13 | .Python 14 | env/ 15 | build/ 16 | develop-eggs/ 17 | dist/ 18 | downloads/ 19 | eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | 47 | # Translations 48 | *.mo 49 | *.pot 50 | 51 | # Django stuff: 52 | *.log 53 | 54 | # Sphinx documentation 55 | docs/_build/ 56 | 57 | # PyBuilder 58 | target/ 59 | 60 | -------------------------------------------------------------------------------- /LICENSE-pythonw.txt: -------------------------------------------------------------------------------- 1 | A. HISTORY OF THE SOFTWARE 2 | ========================== 3 | 4 | Python was created in the early 1990s by Guido van Rossum at Stichting 5 | Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands 6 | as a successor of a language called ABC. Guido remains Python's 7 | principal author, although it includes many contributions from others. 8 | 9 | In 1995, Guido continued his work on Python at the Corporation for 10 | National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) 11 | in Reston, Virginia where he released several versions of the 12 | software. 13 | 14 | In May 2000, Guido and the Python core development team moved to 15 | BeOpen.com to form the BeOpen PythonLabs team. In October of the same 16 | year, the PythonLabs team moved to Digital Creations (now Zope 17 | Corporation, see http://www.zope.com). In 2001, the Python Software 18 | Foundation (PSF, see http://www.python.org/psf/) was formed, a 19 | non-profit organization created specifically to own Python-related 20 | Intellectual Property. Zope Corporation is a sponsoring member of 21 | the PSF. 22 | 23 | All Python releases are Open Source (see http://www.opensource.org for 24 | the Open Source Definition). Historically, most, but not all, Python 25 | releases have also been GPL-compatible; the table below summarizes 26 | the various releases. 27 | 28 | Release Derived Year Owner GPL- 29 | from compatible? (1) 30 | 31 | 0.9.0 thru 1.2 1991-1995 CWI yes 32 | 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes 33 | 1.6 1.5.2 2000 CNRI no 34 | 2.0 1.6 2000 BeOpen.com no 35 | 1.6.1 1.6 2001 CNRI yes (2) 36 | 2.1 2.0+1.6.1 2001 PSF no 37 | 2.0.1 2.0+1.6.1 2001 PSF yes 38 | 2.1.1 2.1+2.0.1 2001 PSF yes 39 | 2.2 2.1.1 2001 PSF yes 40 | 2.1.2 2.1.1 2002 PSF yes 41 | 2.1.3 2.1.2 2002 PSF yes 42 | 2.2.1 2.2 2002 PSF yes 43 | 2.2.2 2.2.1 2002 PSF yes 44 | 2.2.3 2.2.2 2003 PSF yes 45 | 2.3 2.2.2 2002-2003 PSF yes 46 | 2.3.1 2.3 2002-2003 PSF yes 47 | 2.3.2 2.3.1 2002-2003 PSF yes 48 | 2.3.3 2.3.2 2002-2003 PSF yes 49 | 2.3.4 2.3.3 2004 PSF yes 50 | 2.3.5 2.3.4 2005 PSF yes 51 | 2.4 2.3 2004 PSF yes 52 | 2.4.1 2.4 2005 PSF yes 53 | 2.4.2 2.4.1 2005 PSF yes 54 | 2.4.3 2.4.2 2006 PSF yes 55 | 2.4.4 2.4.3 2006 PSF yes 56 | 2.5 2.4 2006 PSF yes 57 | 2.5.1 2.5 2007 PSF yes 58 | 2.5.2 2.5.2 2008 PSF yes 59 | 60 | Footnotes: 61 | 62 | (1) GPL-compatible doesn't mean that we're distributing Python under 63 | the GPL. All Python licenses, unlike the GPL, let you distribute 64 | a modified version without making your changes open source. The 65 | GPL-compatible licenses make it possible to combine Python with 66 | other software that is released under the GPL; the others don't. 67 | 68 | (2) According to Richard Stallman, 1.6.1 is not GPL-compatible, 69 | because its license has a choice of law clause. According to 70 | CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 71 | is "not incompatible" with the GPL. 72 | 73 | Thanks to the many outside volunteers who have worked under Guido's 74 | direction to make these releases possible. 75 | 76 | 77 | B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON 78 | =============================================================== 79 | 80 | PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 81 | -------------------------------------------- 82 | 83 | 1. This LICENSE AGREEMENT is between the Python Software Foundation 84 | ("PSF"), and the Individual or Organization ("Licensee") accessing and 85 | otherwise using this software ("Python") in source or binary form and 86 | its associated documentation. 87 | 88 | 2. Subject to the terms and conditions of this License Agreement, PSF 89 | hereby grants Licensee a nonexclusive, royalty-free, world-wide 90 | license to reproduce, analyze, test, perform and/or display publicly, 91 | prepare derivative works, distribute, and otherwise use Python 92 | alone or in any derivative version, provided, however, that PSF's 93 | License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 94 | 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation; 95 | All Rights Reserved" are retained in Python alone or in any derivative 96 | version prepared by Licensee. 97 | 98 | 3. In the event Licensee prepares a derivative work that is based on 99 | or incorporates Python or any part thereof, and wants to make 100 | the derivative work available to others as provided herein, then 101 | Licensee hereby agrees to include in any such work a brief summary of 102 | the changes made to Python. 103 | 104 | 4. PSF is making Python available to Licensee on an "AS IS" 105 | basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR 106 | IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND 107 | DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS 108 | FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT 109 | INFRINGE ANY THIRD PARTY RIGHTS. 110 | 111 | 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 112 | FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS 113 | A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, 114 | OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 115 | 116 | 6. This License Agreement will automatically terminate upon a material 117 | breach of its terms and conditions. 118 | 119 | 7. Nothing in this License Agreement shall be deemed to create any 120 | relationship of agency, partnership, or joint venture between PSF and 121 | Licensee. This License Agreement does not grant permission to use PSF 122 | trademarks or trade name in a trademark sense to endorse or promote 123 | products or services of Licensee, or any third party. 124 | 125 | 8. By copying, installing or otherwise using Python, Licensee 126 | agrees to be bound by the terms and conditions of this License 127 | Agreement. 128 | 129 | 130 | BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 131 | ------------------------------------------- 132 | 133 | BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 134 | 135 | 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an 136 | office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the 137 | Individual or Organization ("Licensee") accessing and otherwise using 138 | this software in source or binary form and its associated 139 | documentation ("the Software"). 140 | 141 | 2. Subject to the terms and conditions of this BeOpen Python License 142 | Agreement, BeOpen hereby grants Licensee a non-exclusive, 143 | royalty-free, world-wide license to reproduce, analyze, test, perform 144 | and/or display publicly, prepare derivative works, distribute, and 145 | otherwise use the Software alone or in any derivative version, 146 | provided, however, that the BeOpen Python License is retained in the 147 | Software, alone or in any derivative version prepared by Licensee. 148 | 149 | 3. BeOpen is making the Software available to Licensee on an "AS IS" 150 | basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR 151 | IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND 152 | DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS 153 | FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT 154 | INFRINGE ANY THIRD PARTY RIGHTS. 155 | 156 | 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE 157 | SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS 158 | AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY 159 | DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 160 | 161 | 5. This License Agreement will automatically terminate upon a material 162 | breach of its terms and conditions. 163 | 164 | 6. This License Agreement shall be governed by and interpreted in all 165 | respects by the law of the State of California, excluding conflict of 166 | law provisions. Nothing in this License Agreement shall be deemed to 167 | create any relationship of agency, partnership, or joint venture 168 | between BeOpen and Licensee. This License Agreement does not grant 169 | permission to use BeOpen trademarks or trade names in a trademark 170 | sense to endorse or promote products or services of Licensee, or any 171 | third party. As an exception, the "BeOpen Python" logos available at 172 | http://www.pythonlabs.com/logos.html may be used according to the 173 | permissions granted on that web page. 174 | 175 | 7. By copying, installing or otherwise using the software, Licensee 176 | agrees to be bound by the terms and conditions of this License 177 | Agreement. 178 | 179 | 180 | CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 181 | --------------------------------------- 182 | 183 | 1. This LICENSE AGREEMENT is between the Corporation for National 184 | Research Initiatives, having an office at 1895 Preston White Drive, 185 | Reston, VA 20191 ("CNRI"), and the Individual or Organization 186 | ("Licensee") accessing and otherwise using Python 1.6.1 software in 187 | source or binary form and its associated documentation. 188 | 189 | 2. Subject to the terms and conditions of this License Agreement, CNRI 190 | hereby grants Licensee a nonexclusive, royalty-free, world-wide 191 | license to reproduce, analyze, test, perform and/or display publicly, 192 | prepare derivative works, distribute, and otherwise use Python 1.6.1 193 | alone or in any derivative version, provided, however, that CNRI's 194 | License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 195 | 1995-2001 Corporation for National Research Initiatives; All Rights 196 | Reserved" are retained in Python 1.6.1 alone or in any derivative 197 | version prepared by Licensee. Alternately, in lieu of CNRI's License 198 | Agreement, Licensee may substitute the following text (omitting the 199 | quotes): "Python 1.6.1 is made available subject to the terms and 200 | conditions in CNRI's License Agreement. This Agreement together with 201 | Python 1.6.1 may be located on the Internet using the following 202 | unique, persistent identifier (known as a handle): 1895.22/1013. This 203 | Agreement may also be obtained from a proxy server on the Internet 204 | using the following URL: http://hdl.handle.net/1895.22/1013". 205 | 206 | 3. In the event Licensee prepares a derivative work that is based on 207 | or incorporates Python 1.6.1 or any part thereof, and wants to make 208 | the derivative work available to others as provided herein, then 209 | Licensee hereby agrees to include in any such work a brief summary of 210 | the changes made to Python 1.6.1. 211 | 212 | 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" 213 | basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR 214 | IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND 215 | DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS 216 | FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT 217 | INFRINGE ANY THIRD PARTY RIGHTS. 218 | 219 | 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 220 | 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS 221 | A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, 222 | OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 223 | 224 | 6. This License Agreement will automatically terminate upon a material 225 | breach of its terms and conditions. 226 | 227 | 7. This License Agreement shall be governed by the federal 228 | intellectual property law of the United States, including without 229 | limitation the federal copyright law, and, to the extent such 230 | U.S. federal law does not apply, by the law of the Commonwealth of 231 | Virginia, excluding Virginia's conflict of law provisions. 232 | Notwithstanding the foregoing, with regard to derivative works based 233 | on Python 1.6.1 that incorporate non-separable material that was 234 | previously distributed under the GNU General Public License (GPL), the 235 | law of the Commonwealth of Virginia shall govern this License 236 | Agreement only as to issues arising under or with respect to 237 | Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this 238 | License Agreement shall be deemed to create any relationship of 239 | agency, partnership, or joint venture between CNRI and Licensee. This 240 | License Agreement does not grant permission to use CNRI trademarks or 241 | trade name in a trademark sense to endorse or promote products or 242 | services of Licensee, or any third party. 243 | 244 | 8. By clicking on the "ACCEPT" button where indicated, or by copying, 245 | installing or otherwise using Python 1.6.1, Licensee agrees to be 246 | bound by the terms and conditions of this License Agreement. 247 | 248 | ACCEPT 249 | 250 | 251 | CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 252 | -------------------------------------------------- 253 | 254 | Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, 255 | The Netherlands. All rights reserved. 256 | 257 | Permission to use, copy, modify, and distribute this software and its 258 | documentation for any purpose and without fee is hereby granted, 259 | provided that the above copyright notice appear in all copies and that 260 | both that copyright notice and this permission notice appear in 261 | supporting documentation, and that the name of Stichting Mathematisch 262 | Centrum or CWI not be used in advertising or publicity pertaining to 263 | distribution of the software without specific, written prior 264 | permission. 265 | 266 | STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO 267 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 268 | FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE 269 | FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 270 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 271 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 272 | OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 273 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Matthew Scott and Contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include install_pythonw/pythonw.c 2 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | virtualenv-pythonw-osx 2 | =========================== 3 | 4 | Some GUIs Pythona apps don't work right, unless ``pythonw`` is in an app bundle. 5 | 6 | This script only fixes virtualenvs based on Framework style installs (bundles) 7 | 8 | Framework Installs: 9 | --------------------- 10 | 11 | * the default OSX install 12 | * ``brew install python --framework`` 13 | 14 | But **not**: 15 | 16 | * ``brew install python``, which we can't fix using this method 17 | 18 | 19 | 20 | CF: 21 | 22 | https://github.com/pypa/virtualenv/issues/54 23 | http://stackoverflow.com/questions/3692928/why-doesnt-the-save-button-work-on-a-matplotlib-plot 24 | http://code.google.com/p/iterm2/issues/detail?id=1680 25 | 26 | This code attempts to fix this issue, by making sure both ``python`` and ``pythonw`` get 27 | compiled like app bundles. 28 | -------------------------------------------------------------------------------- /install_pythonw/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | 5 | Some GUIs don't work right, unless the python is in an app bundle. 6 | 7 | This script only fixes virtualenvs based on Framework style installs (bundles) 8 | 9 | CF: 10 | 11 | https://github.com/pypa/virtualenv/issues/54 12 | http://stackoverflow.com/questions/3692928/why-doesnt-the-save-button-work-on-a-matplotlib-plot 13 | http://code.google.com/p/iterm2/issues/detail?id=1680 14 | 15 | This code attempts to fix this issue, by making sure both ``python`` and ``pythonw`` get 16 | compiled like app bundles. 17 | """ 18 | 19 | 20 | import os 21 | from os import path 22 | import shutil 23 | from subprocess import call 24 | import sys 25 | import struct 26 | 27 | PYTHON_ARCH = 8 * struct.calcsize("P") 28 | ARCHS = {32:'i386',64:'x86_64'} 29 | 30 | USAGE = """ 31 | Usage: install_pythonw.py ROOT_OF_PARTICULAR_VIRTUALENV 32 | (if you are in the virtualenv right now, try: 33 | 34 | $ which python 35 | 36 | for me: /Users/me/venvs/py27/bin/python 37 | 38 | $ python install_pythonw.py /Users/me/venvs/py27/ 39 | 40 | or 41 | 42 | $ python install_pythonw.py `which python`/../.. 43 | 44 | 45 | """ 46 | 47 | BREW_NOTE = """ 48 | 49 | if this virtualenv is based on the Python installation from Homebrew, 50 | you might want to install "Framework style". This script only fixes 51 | virtualenvs based on OSX Framework-style installs. 52 | 53 | $ brew install python --framework 54 | 55 | 56 | """ 57 | 58 | def main(argv): 59 | if len(argv) != 2: 60 | print USAGE 61 | sys.exit(1) 62 | env_path = path.abspath(argv[1]) 63 | script_path = path.abspath(path.dirname(__file__)) 64 | 65 | # If Python.app already exists, exit. 66 | python_app_dest = path.join(env_path, 'Python.app') 67 | if path.exists(python_app_dest): 68 | print python_app_dest, 'already exists; exiting.' 69 | return 1 70 | # Find pythonw.c in script path. 71 | pythonw_c = path.join(script_path, 'pythonw.c') 72 | if not path.exists(pythonw_c): 73 | print pythonw_c, 'does not exist; exiting.' 74 | return 1 75 | # Find .Python symlink. 76 | dot_python = path.join(env_path, '.Python') 77 | if not path.exists(dot_python): 78 | print dot_python, 'does not exist; exiting.' 79 | return 1 80 | # Find symlink source. 81 | dot_python_src = os.readlink(dot_python) 82 | if not path.exists(dot_python_src): 83 | print dot_python_src, 'does not exist; exiting.' 84 | print BREW_NOTE 85 | return 1 86 | # Find Python.app in PARDIR/Resources/ 87 | python_app_src = path.join( 88 | path.dirname(dot_python_src), 'Resources', 'Python.app') 89 | if not path.exists(python_app_src): 90 | print python_app_src, 'does not exist; exiting.' 91 | return 1 92 | # Copy Python.app to env_path 93 | shutil.copytree(python_app_src, python_app_dest) 94 | # Change install names in Python.app binary. 95 | pythonw_executable = path.join( 96 | python_app_dest, 'Contents', 'MacOS', 'Python') 97 | call([ 98 | 'install_name_tool', 99 | '-change', 100 | dot_python_src, 101 | dot_python, 102 | pythonw_executable, 103 | ]) 104 | # Compile pythonw to bin directory. 105 | for name in ['python','pythonw']: 106 | pythonw_dest = path.join(env_path, 'bin', name) 107 | call([ 108 | 'cc', 109 | '-arch', ARCHS[PYTHON_ARCH], 110 | '-DPYTHONWEXECUTABLE="' + pythonw_executable + '"', 111 | '-o', 112 | pythonw_dest, 113 | pythonw_c, 114 | ]) 115 | 116 | print "finished! App bundle created at: " + python_app_dest 117 | 118 | 119 | def run_main(): 120 | sys.exit(main(sys.argv)) 121 | 122 | 123 | if __name__ == '__main__': 124 | run_main() 125 | -------------------------------------------------------------------------------- /install_pythonw/pythonw.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This wrapper program executes a python executable hidden inside an 3 | * application bundle inside the Python framework. This is needed to run 4 | * GUI code: some GUI API's don't work unless the program is inside an 5 | * application bundle. 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | static char Python[] = PYTHONWEXECUTABLE; 13 | 14 | int main(int argc, char **argv) { 15 | char **a; 16 | a = malloc((argc + 3) * sizeof(char *)); 17 | memcpy(a + 2, argv, argc * sizeof(char *)); 18 | a[0] = "/usr/bin/arch"; 19 | a[1] = sizeof(char *) == 4 ? "-i386" : "-x86_64"; 20 | a[2] = Python; 21 | a[argc+2] = NULL; 22 | execv("/usr/bin/arch", a); 23 | err(1, "execv: %s", "arch"); 24 | /* NOTREACHED */ 25 | } 26 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from setuptools import setup 4 | 5 | setup( 6 | name='fix-osx-virtualenv', 7 | version="0.1", 8 | description='Fixes virtualenvs on Mac OSX to be GUI friendly', 9 | long_description="", 10 | license='MIT', 11 | author='Matthew Scott and Contributors', 12 | classifiers=[ 13 | 'Development Status :: 4 - Beta', 14 | 'Environment :: Console', 15 | 'Intended Audience :: Developers', 16 | 'License :: OSI Approved :: MIT License', 17 | 'Operating System :: MacOS :: MacOS X', 18 | 'Programming Language :: Python', 19 | 'Programming Language :: Python :: 2', 20 | 'Programming Language :: Python :: 2.7', 21 | 'Programming Language :: Python :: 3', 22 | 'Programming Language :: Python :: 3.2', 23 | 'Programming Language :: Python :: 3.3', 24 | 'Programming Language :: Python :: 3.4', 25 | ], 26 | packages=['install_pythonw'], 27 | entry_points={ 28 | 'console_scripts': ['fix-osx-virtualenv = install_pythonw:run_main'], 29 | }, 30 | package_data={'install_pythonw': [ 31 | 'pythonw.c', 32 | ]}, 33 | ) 34 | --------------------------------------------------------------------------------