108 Commits

Author SHA1 Message Date
Kenneth Reitz a484f9b693 pythons 2012-02-26 13:20:33 -05:00
Kenneth Reitz 706d8b4327 yeah 2012-02-26 13:18:08 -05:00
Kenneth Reitz 17b811865c mission statement 2012-02-26 13:17:50 -05:00
utahta ea7cb63494 v1.1 2011-08-29 18:01:31 +09:00
utahta e7943488de release 1.0 2011-08-08 03:09:42 +09:00
utahta 630d525f6a 0.10 -> 1.0 2011-08-08 03:04:42 +09:00
utahta 770715b536 release 0.10 2011-08-08 02:51:43 +09:00
utahta 0112a39aff update 2011-08-08 02:45:29 +09:00
utahta df91a87b24 update 0.10 2011-08-08 02:44:08 +09:00
utahta 212460fd6d update 2011-08-07 15:56:04 +09:00
utahta bfdccb5051 improve venv 2011-08-07 15:36:46 +09:00
utahta bc219fcebe bug fix 2011-08-07 12:58:54 +09:00
utahta 4993f466e9 add systemwide install support 2011-08-07 03:48:38 +09:00
utahta 7b2fa2f0eb Improve symlink command 2011-08-07 00:39:13 +09:00
utahta 90face7065 bug fix 2011-08-07 00:11:23 +09:00
utahta 4ef2954bd6 bug fix 2011-08-07 00:08:37 +09:00
utahta 1025529528 update readme 2011-08-06 23:58:47 +09:00
utahta 04f4cd15b3 Improve venv command, log and bashrc 2011-08-06 23:56:31 +09:00
utahta 7bdb546fa4 merge develop 2011-07-23 18:00:04 +09:00
utahta 12b392a98c fixed #34 #35 2011-07-23 16:31:37 +09:00
utahta 2eb3b7509f merge #33 2011-07-23 12:19:41 +09:00
utahta b6abb47bc3 cleanup 2011-07-23 12:12:30 +09:00
Chris Ledet 483b49984c updated README with corrected rst syntax 2011-07-22 07:35:05 -07:00
Chris Ledet 704321f040 updated README 2011-07-22 10:34:00 -04:00
utahta e033edcda0 release 0.9 2011-07-22 19:09:59 +09:00
utahta 07828a266d update 2011-07-22 18:38:20 +09:00
utahta 9fbc3273cf update venv command 2011-07-22 01:56:01 +09:00
utahta 4aa62201c7 update venv command 2011-07-21 02:22:00 +09:00
utahta b4a6674fba Added venv command 2011-07-21 02:14:41 +09:00
utahta ef4ff75630 update 2011-07-20 00:08:01 +09:00
utahta 219ad17459 update 2011-07-19 23:17:29 +09:00
utahta b039caf384 Merge branch 'develop' of github.com:utahta/pythonbrew into develop 2011-07-18 22:31:34 +09:00
utahta 1db87055fd Added buildout command 2011-07-18 22:31:13 +09:00
utahta aec7d769b1 bug fix 2011-07-11 19:03:37 +09:00
utahta cfdd193ffe release 0.8 2011-07-11 00:22:48 +09:00
utahta f09e32372d update 2011-07-11 00:01:20 +09:00
utahta 2469c1a7af update 2011-07-10 21:17:05 +09:00
utahta f9bcb60638 update readme 2011-07-10 20:51:27 +09:00
utahta 6cb6cc6057 update 0.8 2011-07-10 20:49:00 +09:00
utahta f410b1d1d8 update 2011-07-08 19:25:18 +09:00
utahta 8a1032b08c #21 support ubuntu 11.04(Natty) 2011-07-07 20:39:19 +09:00
utahta 87d0d7b52f #21 support ubuntu 11.04(Natty) 2011-07-07 19:37:30 +09:00
utahta 7371bde921 update config.cfg 2011-06-29 18:57:09 +09:00
utahta 7e5d138150 #30 bug fix 2011-06-29 18:10:26 +09:00
Thomas Grenfell Smith 7e5f5c72e1 Describe the 'symlink' command better 2011-06-23 16:04:32 -04:00
utahta 4a1174811c bug fix 2011-05-30 03:08:34 +09:00
Yuta 0b7a67b430 Merge branch 'bugfix-python27-environ' of https://github.com/npinto/pythonbrew into npinto-bugfix-python27-environ 2011-05-29 21:30:00 +09:00
Yuta 7f7e1d30a1 added 2.5.6 2011-05-29 21:29:09 +09:00
Nicolas Pinto 01af855533 Cleaning up 2011-05-28 17:12:23 -04:00
Nicolas Pinto 92c48adfac Add patch to fix _environ symbol missing bug in python27, see http://bugs.python.org/issue1602133 2011-05-28 17:10:45 -04:00
Nicolas Pinto 5c5ff69474 Add patch to fix _environ symbol missing bug in python27, see http://bugs.python.org/issue1602133 2011-05-28 17:04:16 -04:00
Nicolas Pinto b4bda56e4b Add patch to fix _environ symbol missing bug in python27, see http://bugs.python.org/issue1602133 2011-05-28 16:35:56 -04:00
utahta 4c64902d1d update README.rst 2011-05-25 22:20:53 -07:00
utahta 5ceec61246 update ChangeLog 2011-05-25 17:36:11 -07:00
Yuta c265aa4b78 release 0.7.3 2011-05-25 20:16:52 +09:00
utahta aa0bc97bc8 update symlink,uninstall command 2011-05-25 13:30:46 +09:00
Yuta c92148805d update py command 2011-05-25 01:01:35 +09:00
Yuta 0dfc0d38f1 update pythonbrew-install 2011-05-24 22:38:40 +09:00
utahta c0f9d4ed57 update symlink command 2011-05-24 18:12:31 +09:00
utahta 91101100a7 update py command 2011-05-19 18:29:31 +09:00
utahta a1e3d240ef support python3 2011-05-17 18:39:49 +09:00
Yuta b5b77fb483 Merge branch 'master' of github.com:utahta/pythonbrew 2011-05-04 23:03:49 +09:00
utahta 3a3f6b00ae remove \r 2011-05-03 20:54:50 -07:00
Chris Rose 48dec674ea Clean off trailing whitespace in the stable version number 2011-05-02 10:00:02 -06:00
Yuta e0b794d2b3 0.7.2 2011-05-02 18:09:18 +09:00
Yuta 20027a4a36 added patch-python26 2011-05-02 17:30:59 +09:00
Yuta 3bc8c36aaa release 0.7.1 2011-04-17 22:35:48 +09:00
Yuta 9731bd3c5c readme 2011-04-17 20:59:42 +09:00
Yuta 9393b66448 modified install and uninstall command 2011-04-17 20:48:48 +09:00
Yuta c8779d0322 added -f option to update command 2011-04-17 10:48:26 +09:00
Yuta 3a220f342a Added -b option to symlink command 2011-04-17 10:43:54 +09:00
Yuta 358bb34395 bug fix 2011-04-13 23:26:01 +09:00
utahta 867ffcb054 refactoring 2011-04-13 18:11:37 +09:00
Yuta cdb92c3e2a pythonbrew-install script accept Python-2.7 2011-04-12 00:44:37 +09:00
Yuta bb24bd5fb4 enable parallel make 2011-04-01 01:28:17 +09:00
Yuta ff2af78672 0.7 release 2011-03-23 01:27:00 +09:00
Yuta eb49f121db Added symlink command. Added --as option. 2011-03-23 01:14:39 +09:00
Yuta 2f3fbeca53 fixed 2011-03-20 04:09:36 +09:00
Yuta 7d002f2429 0.6.9 release 2011-03-20 04:06:05 +09:00
Yuta 4b319dfb8c bug fixed 2011-03-20 04:00:42 +09:00
Yuta 3a9cfe074e update command 2011-03-20 03:45:58 +09:00
Yuta c7c4ab09c8 Added config.cfg 2011-03-20 01:30:20 +09:00
Yuta 459fdae35f Added pybrew to bashrc and Help command by default 2011-03-19 02:26:44 +09:00
Yuta 7e494c1c7e update 0.6.8 2011-03-17 20:29:02 +09:00
Yuta e7d3bc5f8a Added Python-3.2 to the list 2011-03-17 20:20:12 +09:00
utahta acd817860b remove test_dummy.py 2010-12-10 01:37:56 +09:00
utahta f7b0bb80f0 update 0.6.7 2010-12-10 01:29:10 +09:00
utahta 966fa577f7 Bug fixed. Added tests. 2010-12-10 01:26:11 +09:00
utahta 7b2ae023bf update 0.6.6 2010-12-07 16:16:19 +09:00
utahta 2b19c65dce Added py command. 2010-12-07 15:51:11 +09:00
utahta c0d749d7dc update 0.6.5 2010-12-01 01:55:12 +09:00
utahta 15a57b10dc supported file: URIs 2010-12-01 01:52:21 +09:00
utahta 01128aebfd update 0.6.4 2010-11-25 23:31:26 +09:00
utahta 16b465dd24 update ChangeLog 2010-11-25 23:20:40 +09:00
utahta 8e54618ff4 removed installed command. added some functions to bashrc. 2010-11-25 23:14:19 +09:00
utahta 5fadee8e92 update 0.6.3 2010-11-25 01:20:25 +09:00
utahta 611b71d635 added use command. added some functions to bashrc. 2010-11-25 01:12:24 +09:00
utahta 159d839803 update 0.6.2 2010-11-22 02:18:15 +09:00
utahta a7ef06f6ae fixed installed command. 2010-11-22 02:04:16 +09:00
utahta 88157a4a96 , added patch-gestaltmodule.c.diff 2010-11-21 18:23:42 +09:00
utahta c5f31138c1 use curl instead of urllib 2010-11-21 12:44:15 +09:00
utahta 0605c27c57 added some function to bashrc. fixed issue 2. 2010-11-20 07:38:22 +09:00
utahta 0bc17f56db update version 0.6.1 2010-11-18 01:29:24 +09:00
utahta 53236cc001 add managed version file 2010-11-18 00:51:51 +09:00
utahta 2c527f98e1 fixed 2010-11-17 01:26:14 +09:00
utahta 79278f78b3 add setup.py MANIFEST.in 2010-11-17 00:49:42 +09:00
utahta a696654e64 Refactoring: update command 2010-11-16 23:25:43 +09:00
utahta 828f488865 Bug fix. Added list option (--all-versions). 2010-11-15 02:40:31 +09:00
133 changed files with 3076 additions and 5207 deletions
+5
View File
@@ -5,3 +5,8 @@
.settings
.tmp_*
*.pyc
pythonbrew.egg-info
dist
__pycache__
*.swp
.idea
+78 -1
View File
@@ -1,3 +1,80 @@
* 1.1
- Added --framework, --universal and --static options to install command.
* 1.0
- Added systemwide install support. (issue #31)
- Fixed issue #41 Handle venv binary with the symlink command.
- Improved `venv` command (without virtualenvwrapper)
* 0.9
- Added `buildout` command.
- Added `venv` command.
* 0.8
- Fixed issue #21 Added Ubuntu 11.04(Natty) support
- Fixed issue #24 non-framework python27 now defines environ properly. Thanks npinto.
- Fixed issue #27 Cleanup of OS X python build flags
- Fixed issue #28 Describe the 'symlink' command better. Thanks tgs.
- Fixed issue #30 py command does not accept arguments with a space
- Fixed bug: `pythonbrew off` need not have removed the symlink in bin directory
- Added --no-test option to the install command
- Added --verbose option to the install command
- `pythonbrew clean` has been removed. Added `pythonbrew cleanup` instead.
* 0.7.3
- Improved symlink command
- Added python3 support
* 0.7.2
- Bug fixed
* 0.7.1
- Enable parallel make option (--jobs).
- The pythonbrew-install script accept Python-2.7.
- Added -b option to symlink command.
* 0.7
- Added symlink command.
- Added --as option.
* 0.6.9
- Bug fixed.
- Added config.cfg
- Help command by default
* 0.6.8
- Added Python-3.2 to the installation list
* 0.6.7
- Bug fixed: Off command did not work.
- Added tests.
* 0.6.6
- Added py command
* 0.6.5
- Supported file: URIs
* 0.6.4
- Added some functions to bashrc
- Removed installed command
- Bug fix
* 0.6.3
- Added use command
- Added some functions to bashrc
- Bug fix
* 0.6.2
- Use curl instead of urllib
- Added patch-gestaltmodule.c.diff
- Added some functions to bashrc
* 0.6.1
- Add setup.py MANIFEST.in
- Added list option (--all-versions)
- Bug fix
* 0.6
- Compiling Python-2.5.5 and Python-2.4.6 on MacOSX SnowLeopard
- Bug fix
@@ -18,4 +95,4 @@
- Bug fix
* 0.1
- First release
- First release
+3
View File
@@ -0,0 +1,3 @@
recursive-include pythonbrew/patches *
recursive-include pythonbrew/etc *
include pythonbrew_install.py
+211
View File
@@ -0,0 +1,211 @@
Overview
========
pythonbrew is a program to automate the building and installation of Python in the users $HOME.
pythonbrew is inspired by `perlbrew <http://github.com/gugod/App-perlbrew>`_ and `rvm <https://github.com/wayneeseguin/rvm>`_.
Installation
============
The recommended way to download and install pythonbrew is to run these statements in your shell::
curl -kL http://xrl.us/pythonbrewinstall | bash
After that, pythonbrew installs itself to ~/.pythonbrew.
Please add the following line to the end of your ~/.bashrc::
[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
If you need to install pythonbrew into somewhere else, you can do that by setting a PYTHONBREW_ROOT environment variable::
export PYTHONBREW_ROOT=/path/to/pythonbrew
curl -kLO http://xrl.us/pythonbrewinstall
chmod +x pythonbrewinstall
./pythonbrewinstall
For Systemwide(Multi-User) installation
---------------------------------------
If the install script is run as root, pythonbrew will automatically install into /usr/local/pythonbrew.
The pythonbrew will be automatically configured for every user on the system if you install as root.
After installation, where you would normally use `sudo`, non-root users will need to use `sudopybrew`::
sudopybrew install -n -v -j2 2.7.2
Usage
=====
pythonbrew command [options]
Install some pythons::
pythonbrew install 2.7.2
pythonbrew install --verbose 2.7.2
pythonbrew install --force 2.7.2
pythonbrew install --no-test 2.7.2
pythonbrew install --configure="CC=gcc_4.1" 2.7.2
pythonbrew install --no-setuptools 2.7.2
pythonbrew install http://www.python.org/ftp/python/2.7/Python-2.7.2.tgz
pythonbrew install /path/to/Python-2.7.2.tgz
pythonbrew install /path/to/Python-2.7.2
pythonbrew install 2.7.2 3.2
Permanently use the specified python::
pythonbrew switch 2.7.2
pythonbrew switch 3.2
Use the specified python in current shell::
pythonbrew use 2.7.2
Runs a named python file against specified and/or all pythons::
pythonbrew py test.py
pythonbrew py -v test.py # Show verbose output
pythonbrew py -p 2.7.2 -p 3.2 test.py # Use the specified pythons
List the installed pythons::
pythonbrew list
List the available installation pythons::
pythonbrew list -k
Uninstall the specified python::
pythonbrew uninstall 2.7.2
pythonbrew uninstall 2.7.2 3.2
Remove stale source folders and archives::
pythonbrew cleanup
Upgrades pythonbrew to the latest version::
pythonbrew update
pythonbrew update --master
pythonbrew update --develop
Disable pythonbrew::
pythonbrew off
Create/Remove a symbolic link to python (in a directory on your $PATH)::
pythonbrew symlink # Create a symbolic link, like "py2.7.2", for each installed version
pythonbrew symlink -p 2.7.2
pythonbrew symlink pip # Create a symbolic link to the specified script in bin directory
pythonbrew symlink -r # Remove a symbolic link
pythonbrew symlink -v foo # Create a symbolic link to the specified virtual environment python in bin directory
Runs the buildout with specified or current using python::
pythonbrew buildout
pythonbrew buildout -p 2.6.6
Create isolated python environments (uses virtualenv)::
pythonbrew venv init
pythonbrew venv create proj
pythonbrew venv list
pythonbrew venv use proj
pythonbrew venv delete proj
Show version::
pythonbrew version
COMMANDS
========
install <version>
Build and install the given version of python.
Install setuptools and pip automatically.
switch <version>
Permanently use the specified python as default.
use <version>
Use the specified python in current shell.
py <python file>
Runs a named python file against specified and/or all pythons.
list
List the installed all pythons.
list -k <version>
List the available install pythons.
uninstall <version>
Uninstall the given version of python.
cleanup
Remove stale source folders and archives.
update
Upgrades pythonbrew to the latest version.
off
Disable pythonbrew.
symlink
Create/Remove a symbolic link to python (in a directory on your $PATH)
buildout
Runs the buildout with specified or current using python.
venv
Create isolated python environments (uses virtualenv)
version
Show version.
See more details below
`pythonbrew help <command>`
Changelog
=========
1.1 (2011-08-29)
----------------
- Added --framework, --universal and --static options to install command.
1.0 (2011-08-08)
----------------
- Added systemwide install support. (issue #31)
- Fixed issue #41 Handle venv binary with the symlink command.
- Improved `venv` command (without virtualenvwrapper)
0.9 (2011-07-21)
----------------
- Added `venv` command (uses virtualenv and virtualenvwrapper)
- Added `buildout` command.
0.8 (2011-07-10)
----------------
- Fixed issue #21 Added Ubuntu 11.04(Natty) support
- Fixed issue #24 non-framework python27 now defines environ properly. Thanks npinto.
- Fixed issue #27 Cleanup of OS X python build flags
- Fixed issue #28 Describe the 'symlink' command better. Thanks tgs.
- Fixed issue #30 py command does not accept arguments with a space
- Fixed bug: `pythonbrew off` need not have removed the symlink in bin directory
- Added --no-test option to the install command
- Added --verbose option to the install command
- `pythonbrew clean` has been removed. Added `pythonbrew cleanup` instead.
More
----
see the `pythonbrew/Changelog <https://github.com/utahta/pythonbrew/blob/master/ChangeLog>`_
+141 -49
View File
@@ -1,68 +1,132 @@
Overview
========
pythonbrew is a program to automate the building and installation of Python in the users HOME.
Pythonbrew is anti-virtualenv. This isn't.
pythonbrew is based on `perlbrew <http://github.com/gugod/App-perlbrew>`_.
Differences:
- No `switch`. That's crazy.
- Bottles (pre-compiled Pythons)
----------------------------------
pythonbrew is a program to automate the building and installation of Python in the users $HOME.
pythonbrew is inspired by `perlbrew <http://github.com/gugod/App-perlbrew>`_ and `rvm <https://github.com/wayneeseguin/rvm>`_.
Installation
============
Following python version is required to use pythonbrew:
2.4 <= Python < 3
The recommended way to download and install pythonbrew is to run these statements in your shell::
The recommended way to download and install pythonbrew is to run these statements in your shell.::
curl -kL http://xrl.us/pythonbrewinstall | bash
curl -LO http://github.com/utahta/pythonbrew/raw/master/pythonbrew-install
chmod +x pythonbrew-install
./pythonbrew-install
After that, pythonbrew installs itself to ~/.pythonbrew.
After that, pythonbrew installs itself to ~/.pythonbrew, and you should follow the instruction on screen to setup your .bashrc or .cshrc to put it in your PATH.
Please add the following line to the end of your ~/.bashrc::
If you need to install pythonbrew into somewhere else, you can do that by setting a PYTHONBREW_ROOT environment variable.::
[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
If you need to install pythonbrew into somewhere else, you can do that by setting a PYTHONBREW_ROOT environment variable::
export PYTHONBREW_ROOT=/path/to/pythonbrew
./pythonbrew-install
curl -kLO http://xrl.us/pythonbrewinstall
chmod +x pythonbrewinstall
./pythonbrewinstall
For Systemwide(Multi-User) installation
---------------------------------------
If the install script is run as root, pythonbrew will automatically install into /usr/local/pythonbrew.
The pythonbrew will be automatically configured for every user on the system if you install as root.
After installation, where you would normally use `sudo`, non-root users will need to use `sudopybrew`::
sudopybrew install -n -v -j2 2.7.2
Usage
=====
pythonbrew command [options]
Install some Pythons::
pythonbrew install 2.6.6
pythonbrew install Python-2.5.5
pythonbrew install --configure="CC=gcc_4.1" Python-2.6.6
pythonbrew install --no-setuptools Python-2.6.6
pythonbrew install http://www.python.org/ftp/python/2.7/Python-2.7.tgz
Switch python in the $PATH::
Install some pythons::
pythonbrew switch 2.6.6
pythonbrew switch Python-2.5.5
pythonbrew install 2.7.2
pythonbrew install --verbose 2.7.2
pythonbrew install --force 2.7.2
pythonbrew install --no-test 2.7.2
pythonbrew install --configure="CC=gcc_4.1" 2.7.2
pythonbrew install --no-setuptools 2.7.2
pythonbrew install http://www.python.org/ftp/python/2.7/Python-2.7.2.tgz
pythonbrew install /path/to/Python-2.7.2.tgz
pythonbrew install /path/to/Python-2.7.2
pythonbrew install 2.7.2 3.2
List the available install versions of Python::
Permanently use the specified python::
pythonbrew list 2.6
pythonbrew list 3.0
pythonbrew switch 2.7.2
pythonbrew switch 3.2
Uninstall some Pythons::
Use the specified python in current shell::
pythonbrew uninstall 2.6.6
pythonbrew use 2.7.2
Runs a named python file against specified and/or all pythons::
pythonbrew py test.py
pythonbrew py -v test.py # Show verbose output
pythonbrew py -p 2.7.2 -p 3.2 test.py # Use the specified pythons
List the installed pythons::
pythonbrew list
List the available installation pythons::
pythonbrew list -k
Uninstall the specified python::
pythonbrew uninstall 2.7.2
pythonbrew uninstall 2.7.2 3.2
Remove stale source folders and archives::
pythonbrew clean
pythonbrew cleanup
Upgrades pythonbrew to the latest version::
pythonbrew update
pythonbrew update --master
pythonbrew update --develop
Disable pythonbrew::
pythonbrew off
Create/Remove a symbolic link to python (in a directory on your $PATH)::
pythonbrew symlink # Create a symbolic link, like "py2.7.2", for each installed version
pythonbrew symlink -p 2.7.2
pythonbrew symlink pip # Create a symbolic link to the specified script in bin directory
pythonbrew symlink -r # Remove a symbolic link
pythonbrew symlink -v foo # Create a symbolic link to the specified virtual environment python in bin directory
Runs the buildout with specified or current using python::
pythonbrew buildout
pythonbrew buildout -p 2.6.6
Create isolated python environments (uses virtualenv)::
pythonbrew venv init
pythonbrew venv create proj
pythonbrew venv list
pythonbrew venv use proj
pythonbrew venv delete proj
Show version::
pythonbrew version
@@ -71,25 +135,28 @@ COMMANDS
========
install <version>
Build and install the given version of Python.
Setuptools and pip is automatically installed.
options: --force, --no-setuptools and --configure.
installed
List the installed versions of python.
Build and install the given version of python.
Install setuptools and pip automatically.
switch <version>
Switch to the given version.
Permanently use the specified python as default.
list <version>
List the available install version of python.
uninstall Python-<version>
use <version>
Use the specified python in current shell.
py <python file>
Runs a named python file against specified and/or all pythons.
list
List the installed all pythons.
list -k <version>
List the available install pythons.
uninstall <version>
Uninstall the given version of python.
clean
cleanup
Remove stale source folders and archives.
update
@@ -98,17 +165,42 @@ update
off
Disable pythonbrew.
symlink
Create/Remove a symbolic link to python (in a directory on your $PATH)
buildout
Runs the buildout with specified or current using python.
venv
Create isolated python environments (uses virtualenv)
version
Show version.
Options
See more details below
`pythonbrew help <command>`
LICENCE
=======
\-f | --force
Force installation of a Python.
The MIT License
\-C | --configure
Custom configure options.
Copyright (c) <2010-2011> <utahta>
\-n | --no-setuptools
Skip installation of setuptools.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+59 -72
View File
@@ -1,6 +1,17 @@
#!/usr/bin/env bash
PYTHON=`command -v python`
shopt -s extglob
PYTHONS="/usr/bin/python /usr/bin/python2 `command -v python`"
CURL=`command -v curl`
trim()
{
trimmed=$1
trimmed="${trimmed#"${trimmed%%[![:space:]]*}"}" # remove leading whitespace characters
trimmed="${trimmed%"${trimmed##*[![:space:]]}"}" # remove trailing whitespace characters
echo $trimmed
}
usage()
{
@@ -21,7 +32,7 @@ parse_arguments()
for arg do
val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
case "$arg" in
--python=*) PYTHON="$val" ;;
--python=*) PYTHONS="$val $PYTHONS" ;;
--help) usage ;;
*) echo "Can't find the option. :$arg";;
esac
@@ -30,95 +41,71 @@ parse_arguments()
parse_arguments $@
if [[ ! -x $PYTHON ]] ; then
echo "I think $PYTHON is not Python interpreter."
if [[ ! -x $CURL ]] ; then
echo "pythonbrew required curl. curl was not found in your path."
exit
fi
PYTHON_VERSION=`$PYTHON -V 2>&1`
PYTHON_VERSION=${PYTHON_VERSION/"Python "/""}
PYTHON_VERSION_S=`echo $PYTHON_VERSION | sed -e "s/\(^[[:digit:]]\{1,\}.[[:digit:]]\{1,\}\).*/\1/"`
for PYTHON in $PYTHONS ; do
if [[ ! -x $PYTHON ]] ; then
continue
fi
if [[ $PYTHON_VERSION_S != "2.4" ]] && [[ $PYTHON_VERSION_S != "2.5" ]] && [[ $PYTHON_VERSION_S != "2.6" ]] ; then
printf "Python's version is $PYTHON_VERSION_S:
2.4 <= python < 3.0 is required.
"
PYTHON_VERSION=`$PYTHON -V 2>&1`
PYTHON_VERSION=${PYTHON_VERSION/"Python "/""}
PYTHON_VERSION_S=`echo $PYTHON_VERSION | sed -e "s/\(^[[:digit:]]\{1,\}.[[:digit:]]\{1,\}\).*/\1/"`
if [[ $PYTHON_VERSION_S = "2.4" ]] || [[ $PYTHON_VERSION_S = "2.5" ]] || [[ $PYTHON_VERSION_S = "2.6" ]] || [[ $PYTHON_VERSION_S = "2.7" ]] || [[ ${PYTHON_VERSION_S:0:1} = "3" ]] ; then
PYTHON_FOUND='1'
break
fi
done
if [[ $PYTHON_FOUND != '1' ]] ; then
echo "pythonbrew required Python (2.4, 2.5, 2.6 or 2.7)."
#TODO Installing python.
exit
fi
ROOT="$HOME/.pythonbrew"
if [[ -n $PYTHONBREW_ROOT ]] ; then
ROOT=$PYTHONBREW_ROOT
systemwide_install=0
if [[ -n "$PYTHONBREW_ROOT" ]] ; then
ROOT="$PYTHONBREW_ROOT"
else
if (( UID == 0 )) ; then
systemwide_install=1
ROOT="/usr/local/pythonbrew"
else
ROOT="$HOME/.pythonbrew"
fi
fi
PATH_DISTS="$ROOT/dists"
PATH_ETC="$ROOT/etc"
mkdir -p $PATH_DISTS
rm -rf $PATH_DISTS/pythonbrew.tar.gz
rm -rf $PATH_DISTS/utahta-pythonbrew*
STABLE_VERSION=`curl -skL https://github.com/utahta/pythonbrew/raw/master/stable-version.txt`
STABLE_VERSION=`trim $STABLE_VERSION`
if [[ -z "$STABLE_VERSION" ]] ; then
echo 'Can not get stable-version of pythonbrew.'
exit 1
fi
TEMP_FILE="pythonbrew-$STABLE_VERSION"
TEMP_TARBALL="$TEMP_FILE.tar.gz"
DOWNLOAD_URL="http://pypi.python.org/packages/source/p/pythonbrew/$TEMP_TARBALL"
TEMP_TARBALL="pythonbrew.tar.gz"
DOWNLOAD_URL="http://github.com/utahta/pythonbrew/tarball/master"
mkdir -p "$PATH_DISTS"
rm -rf "$PATH_DISTS/$TEMP_TARBALL"
rm -rf "$PATH_DISTS/$TEMP_FILE"
echo "Downloading $DOWNLOAD_URL"
builtin cd $PATH_DISTS ; curl -L $DOWNLOAD_URL -o "$TEMP_TARBALL" > /dev/null 2>&1
builtin cd $PATH_DISTS ; curl --progress-bar -kL $DOWNLOAD_URL -o "$TEMP_TARBALL"
echo "Extracting $PATH_DISTS/$TEMP_TARBALL"
builtin cd $PATH_DISTS ; tar zxf $TEMP_TARBALL
TEMP_FILE=`ls $PATH_DISTS | grep utahta-pythonbrew`
echo "Installing pythonbrew into $ROOT"
$PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py
if (( systemwide_install == 1 )) ; then
PYTHONBREW_ROOT="$ROOT" $PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py --systemwide
else
$PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py
fi
if [[ $? == 1 ]] ; then
echo "Failed to install pythonbrew."
exit
fi
case $SHELL in
*tcsh)
shrc="cshrc"
yourshrc="tcshrc"
;;
*csh)
shrc="cshrc"
yourshrc=$shrc
;;
*)
shrc="bashrc"
yourshrc=$shrc
;;
esac
printf "
The pythonbrew is installed as:
$ROOT/bin/pythonbrew
You may trash the downloaded $0 from now on.
Pythonbrew environment initiated, required directories are created under
$ROOT
Well-done! Congratulations! Please add the following line to the end
of your ~/.$yourshrc
source $PATH_ETC/$shrc
After that, exit this shell, start a new one, and install some fresh
pythons:
pythonbrew install 2.6.6
pythonbrew install 2.5.5
For further instructions, run:
pythonbrew help
The default help messages will popup and tell you what to do!
Enjoy pythonbrew at $ROOT!!
"
+12 -4
View File
@@ -1,19 +1,27 @@
import sys
import os
from pythonbrew.basecommand import command_dict, load_all_commands
from pythonbrew.baseparser import parser
from pythonbrew.log import logger
from pythonbrew.define import PATH_HOME_ETC
from pythonbrew.util import makedirs
def init_home():
if not os.path.isdir(PATH_HOME_ETC):
makedirs(PATH_HOME_ETC)
def main():
options, args = parser.parse_args(sys.argv[1:])
if options.help and not args:
args = ["help"]
args = ['help']
if not args:
parser.error('You must give a command (use "pythonbrew help" to see a list of commands)')
return
args = ['help'] # as default
init_home()
load_all_commands()
command = args[0].lower()
if command not in command_dict:
parser.error("Unknown command: `%s`" % command)
return
command = command_dict[command]
command.run(args)
command.run(args[1:])
+2 -3
View File
@@ -3,7 +3,6 @@ import sys
import re
from optparse import OptionParser
from pythonbrew import commands
from pythonbrew.define import PATH_BIN_PYTHONBREW
command_dict = {}
@@ -14,12 +13,12 @@ class Command(object):
def __init__(self):
self.parser = OptionParser(usage=self.usage,
prog='%s %s' % (PATH_BIN_PYTHONBREW, self.name))
prog='%s %s' % ("pythonbrew", self.name))
command_dict[self.name] = self
def run(self, args):
options, args = self.parser.parse_args(args)
self.run_command(options, args[1:])
self.run_command(options, args)
def load_command(name):
full_name = 'pythonbrew.commands.%s' % name
+2 -2
View File
@@ -1,8 +1,8 @@
from optparse import OptionParser
from pythonbrew.define import VERSION, PATH_BIN_PYTHONBREW
from pythonbrew.define import VERSION
parser = OptionParser(usage="%prog COMMAND [OPTIONS]",
prog=PATH_BIN_PYTHONBREW,
prog="pythonbrew",
version=VERSION,
add_help_option=False)
parser.add_option(
+58
View File
@@ -0,0 +1,58 @@
import os
import sys
import subprocess
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS, BOOTSTRAP_DLSITE
from pythonbrew.util import Package, get_using_python_pkgname, Link, is_installed
from pythonbrew.log import logger
from pythonbrew.downloader import Downloader
class BuildoutCommand(Command):
name = "buildout"
usage = "%prog"
summary = "Runs the buildout with specified or current using python"
def __init__(self):
super(BuildoutCommand, self).__init__()
self.parser.add_option(
"-p", "--python",
dest="python",
default=None,
help="Use the specified version of python.",
metavar='VERSION'
)
def run_command(self, options, args):
if options.python:
pkgname = Package(options.python).name
else:
pkgname = get_using_python_pkgname()
if not is_installed(pkgname):
logger.error('`%s` is not installed.' % pkgname)
sys.exit(1)
logger.info('Using %s' % pkgname)
# build a path
python = os.path.join(PATH_PYTHONS, pkgname, 'bin', 'python')
# Download bootstrap.py
download_url = BOOTSTRAP_DLSITE
filename = Link(download_url).filename
bootstrap = os.path.join(os.getcwd(), filename) # fetching into current directory
try:
d = Downloader()
d.download(filename, download_url, bootstrap)
except:
e = sys.exc_info()[1]
logger.error("%s" % (e))
sys.exit(1)
# call bootstrap.py
if subprocess.call([python, bootstrap, '-d']):
logger.error('Failed to bootstrap.')
sys.exit(1)
# call buildout
subprocess.call(['./bin/buildout'])
BuildoutCommand()
@@ -3,17 +3,17 @@ from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_BUILD, PATH_DISTS
from pythonbrew.util import rm_r
class CleanCommand(Command):
name = "clean"
class CleanupCommand(Command):
name = "cleanup"
usage = "%prog"
summary = "Remove stale source folders and archives"
def run_command(self, options, args):
self._clean(PATH_BUILD)
self._clean(PATH_DISTS)
self._cleanup(PATH_BUILD)
self._cleanup(PATH_DISTS)
def _clean(self, root):
def _cleanup(self, root):
for dir in os.listdir(root):
rm_r("%s/%s" % (root, dir))
rm_r(os.path.join(root, dir))
CleanCommand()
CleanupCommand()
+4 -4
View File
@@ -17,11 +17,11 @@ class HelpCommand(Command):
command.parser.print_help()
return
parser.print_help()
logger.info("\nCommands available:")
logger.log("\nCommands available:")
commands = [command_dict[key] for key in sorted(command_dict.keys())]
for command in commands:
logger.info(" %s: %s" % (command.name, command.summary))
logger.info("\nFurther Instructions:")
logger.info(" http://github.com/utahta/pythonbrew")
logger.log(" %s: %s" % (command.name, command.summary))
logger.log("\nFurther Instructions:")
logger.log(" https://github.com/utahta/pythonbrew")
HelpCommand()
+70 -12
View File
@@ -1,6 +1,8 @@
import sys
from pythonbrew.basecommand import Command
from pythonbrew.log import logger
from pythonbrew.installer import PythonInstaller
from pythonbrew.installer.pythoninstaller import PythonInstaller,\
PythonInstallerMacOSX
from pythonbrew.util import is_macosx
class InstallCommand(Command):
name = "install"
@@ -14,28 +16,84 @@ class InstallCommand(Command):
dest="force",
action="store_true",
default=False,
help="Force installation of a Python."
help="Force installation of python."
)
self.parser.add_option(
"-n", "--no-test",
dest="no_test",
action="store_true",
default=False,
help="Skip `make test`."
)
self.parser.add_option(
"-v", "--verbose",
dest="verbose",
action="store_true",
default=False,
help="Display log information on the console."
)
self.parser.add_option(
"-C", "--configure",
dest="configure",
default="",
metavar="CONFIGURE_OPTIONS",
help="Custom configure options."
help="Options passed directly to configure."
)
self.parser.add_option(
"-n", "--no-setuptools",
"--no-setuptools",
dest="no_setuptools",
action="store_true",
default=False,
help="Skip installation of setuptools."
)
self.parser.add_option(
"--as",
dest="alias",
default=None,
help="Install a python under an alias."
)
self.parser.add_option(
'-j', "--jobs",
dest="jobs",
type='int',
default=0,
help="Enable parallel make."
)
self.parser.add_option(
"--framework",
dest="framework",
action="store_true",
default=False,
help="Build (MacOSX|Darwin) framework."
)
self.parser.add_option(
"--universal",
dest="universal",
action="store_true",
default=False,
help="Build for both 32 & 64 bit Intel."
)
self.parser.add_option(
"--static",
dest="static",
action="store_true",
default=False,
help="Build static libraries."
)
def run_command(self, options, args):
if args:
# Install Python
PythonInstaller(args[0], options).install()
else:
logger.error("Package not found.")
if not args:
self.parser.print_help()
sys.exit(1)
# installing python
for arg in args:
try:
if is_macosx():
p = PythonInstallerMacOSX(arg, options)
else:
p = PythonInstaller(arg, options)
p.install()
except:
continue
InstallCommand()
-26
View File
@@ -1,26 +0,0 @@
import os
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS
from pythonbrew.log import logger
import sys
class InstalledCommand(Command):
name = "installed"
usage = "%prog"
summary = "List the installed versions of python"
def run_command(self, options, args):
cur = ""
if not os.path.islink("%s/current" % PATH_PYTHONS):
logger.info("%s (*)" % sys.executable)
elif os.path.islink("%s/current" % PATH_PYTHONS):
cur = os.path.basename(os.path.realpath("%s/current" % PATH_PYTHONS))
for d in sorted(os.listdir("%s/" % PATH_PYTHONS)):
if d == "current":
continue
if cur == d:
logger.info("%s (*)" % cur)
else:
logger.info("%s" % (d))
InstalledCommand()
+46 -12
View File
@@ -1,34 +1,68 @@
import os
import re
from pythonbrew.basecommand import Command
from pythonbrew.define import PYTHON_PACKAGE_URL
from pythonbrew.util import Package
from pythonbrew.define import PYTHON_VERSION_URL, LATEST_VERSIONS_OF_PYTHON,\
PATH_PYTHONS
from pythonbrew.util import Package, get_using_python_pkgname
from pythonbrew.log import logger
class ListCommand(Command):
name = "list"
usage = "%prog [VERSION]"
summary = "List the available install version of python"
summary = "List the installed all pythons"
def __init__(self):
super(ListCommand, self).__init__()
self.parser.add_option(
'-a', '--all-versions',
dest='all_versions',
action='store_true',
default=False,
help='Show the all python versions.'
)
self.parser.add_option(
'-k', '--known',
dest='known',
action='store_true',
default=False,
help='List the available latest python versions.'
)
def run_command(self, options, args):
if options.known:
self.available_install(options, args)
else:
self.installed(options, args)
def installed(self, options, args):
logger.log("# pythonbrew pythons")
cur = get_using_python_pkgname()
for d in sorted(os.listdir(PATH_PYTHONS)):
if cur and cur == d:
logger.log(' %s (*)' % d)
else:
logger.log(' %s' % d)
def available_install(self, options, args):
logger.log('# Pythons')
if args:
pkg = Package(args[0])
_re = re.compile(r"%s" % pkg.name)
pkgs = []
for pkgname in self._get_packages_name():
for pkgname in self._get_packages_name(options):
if _re.match(pkgname):
pkgs.append(pkgname)
if pkgs:
logger.info("Pythons:")
for pkgname in pkgs:
logger.info(" %s" % pkgname)
logger.log("%s" % pkgname)
else:
print "Package not found. `%s`" % pkg.name
logger.error("`%s` was not found." % pkg.name)
else:
logger.info("Pythons:")
for pkgname in self._get_packages_name():
logger.info(" %s" % pkgname)
for pkgname in self._get_packages_name(options):
logger.log("%s" % pkgname)
def _get_packages_name(self):
return ["Python-%s" % version for version in sorted(PYTHON_PACKAGE_URL.keys())]
def _get_packages_name(self, options):
return ["Python-%s" % version for version in sorted(PYTHON_VERSION_URL.keys())
if(options.all_versions or (not options.all_versions and version in LATEST_VERSIONS_OF_PYTHON))]
ListCommand()
+56
View File
@@ -0,0 +1,56 @@
import os
import sys
import subprocess
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS
from pythonbrew.util import Package
from pythonbrew.log import logger
class PyCommand(Command):
name = "py"
usage = "%prog PYTHON_FILE"
summary = "Runs a named python file against specified and/or all pythons"
def __init__(self):
super(PyCommand, self).__init__()
self.parser.add_option(
"-p", "--python",
dest="pythons",
action="append",
default=[],
help="Use the specified python version.",
metavar='VERSION'
)
self.parser.add_option(
"-v", "--verbose",
dest="verbose",
action="store_true",
default=False,
help="Show the running python version."
)
self.parser.disable_interspersed_args()
def run_command(self, options, args):
if not args:
self.parser.print_help()
sys.exit(1)
pythons = self._get_pythons(options.pythons)
for d in pythons:
if options.verbose:
logger.info('`%s` running...' % d)
path = os.path.join(PATH_PYTHONS, d, 'bin', args[0])
if os.path.isfile(path) and os.access(path, os.X_OK):
subprocess.call([path] + args[1:])
else:
path = os.path.join(PATH_PYTHONS, d, 'bin', 'python')
if os.path.isfile(path) and os.access(path, os.X_OK):
subprocess.call([path] + args)
else:
logger.error('%s: No such file or directory.' % path)
def _get_pythons(self, _pythons):
pythons = [Package(p).name for p in _pythons]
return [d for d in sorted(os.listdir(PATH_PYTHONS))
if not pythons or d in pythons]
PyCommand()
+9 -22
View File
@@ -1,41 +1,28 @@
import os
import sys
import re
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS, PATH_BIN
from pythonbrew.util import off, symlink, Package
from pythonbrew.define import PATH_PYTHONS
from pythonbrew.util import Package, set_current_path, is_installed
from pythonbrew.log import logger
class SwitchCommand(Command):
name = "switch"
usage = "%prog VERSION"
summary = "Switch to the given version"
summary = "Permanently use the specified python as default"
def run_command(self, options, args):
if not args:
logger.error("Unrecognized command line argument: argument not found.")
self.parser.print_help()
sys.exit(1)
pkg = Package(args[0])
pkgname = pkg.name
pkgdir = "%s/%s" % (PATH_PYTHONS, pkgname)
if not os.path.isdir(pkgdir):
if not is_installed(pkgname):
logger.error("`%s` is not installed." % pkgname)
sys.exit(1)
self._switch_dir(pkgdir)
pkgbin = os.path.join(PATH_PYTHONS,pkgname,'bin')
set_current_path(pkgbin)
logger.info("Switched to %s" % pkgname)
def _switch_dir(self, pkgdir):
off()
symlink(pkgdir, "%s/current" % PATH_PYTHONS)
for root, dirs, files in os.walk("%s/current/bin/" % PATH_PYTHONS):
for f in files:
symlink("%s%s" % (root, f), "%s/%s" % (PATH_BIN, f))
break
# I want better code
if not os.path.isfile("%s/python" % PATH_BIN):
if os.path.isfile("%s/python3" % PATH_BIN):
symlink(os.path.realpath("%s/python3" % PATH_BIN), "%s/python" % PATH_BIN)
elif os.path.isfile("%s/python3.0" % PATH_BIN):
symlink(os.path.realpath("%s/python3.0" % PATH_BIN), "%s/python" % PATH_BIN)
SwitchCommand()
+117
View File
@@ -0,0 +1,117 @@
import os
import sys
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS, PATH_BIN, PATH_VENVS
from pythonbrew.util import Package, symlink, unlink, get_using_python_pkgname,\
is_installed
from pythonbrew.log import logger
class SymlinkCommand(Command):
name = "symlink"
usage = "%prog [OPTIONS] [SCRIPT]"
summary = "Create/Remove a symbolic link on your $PATH"
def __init__(self):
super(SymlinkCommand, self).__init__()
self.parser.add_option(
"-p", "--python",
dest="pythons",
action="append",
default=[],
help="Use the specified python version.",
metavar='VERSION'
)
self.parser.add_option(
"-r", "--remove",
dest="remove",
action="store_true",
default=False,
help="Remove the all symbolic link."
)
self.parser.add_option(
"-d", "--default",
dest="default",
default=None,
help="Use as default the specified python version."
)
self.parser.add_option(
"-v", "--venv",
dest="venv",
default=None,
help="Use the virtual environment python."
)
def run_command(self, options, args):
if options.default:
# create only one instance as default of an application.
pythons = self._get_pythons([options.default])
for pkgname in pythons:
if args:
bin = args[0]
self._symlink(bin, bin, pkgname)
else:
self._symlink('python', 'py', pkgname)
elif options.venv:
if options.pythons:
pkgname = Package(options.pythons[0]).name
else:
pkgname = get_using_python_pkgname()
if not is_installed(pkgname):
logger.error('`%s` is not installed.')
sys.exit(1)
venv_pkgdir = os.path.join(PATH_VENVS, pkgname)
venv_dir = os.path.join(venv_pkgdir, options.venv)
if not os.path.isdir(venv_dir):
logger.error("`%s` environment was not found in %s." % (options.venv, venv_pkgdir))
sys.exit(1)
pkg = Package(pkgname)
if args:
bin = args[0]
dstbin = '%s%s-%s' % (bin, pkg.version, options.venv)
self._symlink(bin, dstbin, pkgname)
else:
dstbin = 'py%s-%s' % (pkg.version, options.venv)
self._symlink('python', dstbin, pkgname)
else:
pythons = self._get_pythons(options.pythons)
for pkgname in pythons:
if options.remove:
# remove symlinks
for bin in os.listdir(PATH_BIN):
path = os.path.join(PATH_BIN, bin)
if os.path.islink(path):
unlink(path)
else:
# create symlinks
if args:
bin = args[0]
self._symlink_version_suffix(bin, bin, pkgname)
else:
self._symlink_version_suffix('python', 'py', pkgname)
def _symlink_version_suffix(self, srcbin, dstbin, pkgname):
"""Create a symlink. add version suffix.
"""
version = Package(pkgname).version
dstbin = '%s%s' % (dstbin, version)
self._symlink(srcbin, dstbin, pkgname)
def _symlink(self, srcbin, dstbin, pkgname):
"""Create a symlink.
"""
src = os.path.join(PATH_PYTHONS, pkgname, 'bin', srcbin)
dst = os.path.join(PATH_BIN, dstbin)
if os.path.isfile(src):
symlink(src, dst)
else:
logger.error("%s was not found in your path." % src)
def _get_pythons(self, _pythons):
"""Get the installed python versions list.
"""
pythons = [Package(p).name for p in _pythons]
return [d for d in sorted(os.listdir(PATH_PYTHONS))
if not pythons or d in pythons]
SymlinkCommand()
+23 -13
View File
@@ -1,8 +1,8 @@
import os
import sys
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS
from pythonbrew.util import off, rm_r, Package
from pythonbrew.define import PATH_PYTHONS, PATH_BIN, PATH_VENVS
from pythonbrew.util import off, rm_r, Package, get_using_python_pkgname, unlink,\
is_installed
from pythonbrew.log import logger
class UninstallCommand(Command):
@@ -12,17 +12,27 @@ class UninstallCommand(Command):
def run_command(self, options, args):
if args:
pkg = Package(args[0])
pkgname = pkg.name
pkgpath = "%s/%s" % (PATH_PYTHONS, pkgname)
if not os.path.isdir(pkgpath):
logger.error("`%s` is not installed." % pkgname)
sys.exit(1)
if os.path.islink("%s/current" % PATH_PYTHONS):
curpath = os.path.realpath("%s/current" % PATH_PYTHONS)
if pkgpath == curpath:
# Uninstall pythons
for arg in args:
pkg = Package(arg)
pkgname = pkg.name
pkgpath = os.path.join(PATH_PYTHONS, pkgname)
venvpath = os.path.join(PATH_VENVS, pkgname)
if not is_installed(pkgname):
logger.error("`%s` is not installed." % pkgname)
continue
if get_using_python_pkgname() == pkgname:
off()
rm_r(pkgpath)
for d in os.listdir(PATH_BIN):
# remove symlink
path = os.path.join(PATH_BIN, d)
if os.path.islink(path):
basename = os.path.basename(os.path.realpath(path))
tgtpath = os.path.join(pkgpath, 'bin', basename)
if os.path.isfile(tgtpath) and os.path.samefile(path, tgtpath):
unlink(path)
rm_r(pkgpath)
rm_r(venvpath)
else:
self.parser.print_help()
+93 -40
View File
@@ -1,64 +1,117 @@
import os
import sys
import re
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_DISTS, VERSION, PYTHONBREW_DIRNAME, ROOT
from pythonbrew.define import PATH_DISTS, VERSION, ROOT,\
PATH_BUILD, PYTHONBREW_UPDATE_URL_CONFIG, PATH_ETC_CONFIG
from pythonbrew.log import logger
from pythonbrew.downloader import Downloader, get_pythonbrew_update_url
from pythonbrew.util import Subprocess, rm_r
from pythonbrew.downloader import Downloader, get_pythonbrew_update_url,\
get_stable_version, get_headerinfo_from_url
from pythonbrew.util import rm_r, extract_downloadfile, Link, is_gzip, Subprocess, Version
class UpdateCommand(Command):
name = "update"
usage = "%prog"
summary = "Upgrades pythonbrew to the latest version"
summary = "Update the pythonbrew to the latest version"
def __init__(self):
super(UpdateCommand, self).__init__()
self.parser.add_option(
'--master',
dest='master',
action='store_true',
default=False,
help='Update the pythonbrew to the `master` branch on github.'
)
self.parser.add_option(
'--develop',
dest='develop',
action='store_true',
default=False,
help='Update the pythonbrew to the `develop` branch on github.'
)
self.parser.add_option(
'--config',
dest='config',
action='store_true',
default=False,
help='Update config.cfg.'
)
self.parser.add_option(
'-f', '--force',
dest='force',
action='store_true',
default=False,
help='Force update the pythonbrew.'
)
def run_command(self, options, args):
version = "head"
if args:
version = args[0]
# check for latest version
if version <= VERSION:
logger.info("You are already running the installed latest version of pythonbrew.")
sys.exit()
download_url = get_pythonbrew_update_url(version)
if options.config:
self._update_config(options, args)
else:
self._update_pythonbrew(options, args)
def _update_config(self, options, args):
# config.cfg update
# TODO: Automatically create for config.cfg
download_url = PYTHONBREW_UPDATE_URL_CONFIG
if not download_url:
logger.error("`%s` of pythonbrew not found." % version)
logger.error("Invalid download url in config.cfg. `%s`" % download_url)
sys.exit(1)
distname = "pythonbrew.tgz"
download_path = "%s/%s" % (PATH_DISTS, distname)
distname = Link(PYTHONBREW_UPDATE_URL_CONFIG).filename
download_file = PATH_ETC_CONFIG
try:
d = Downloader()
d.download(distname, download_url, download_path)
d.download(distname, download_url, download_file)
except:
logger.error("Failed to download. `%s`" % download_url)
sys.exit(1)
_re = re.compile("^%s.*" % PYTHONBREW_DIRNAME)
for name in os.listdir(PATH_DISTS):
if _re.match(name):
rm_r("%s/%s" % (PATH_DISTS, name))
logger.log("The config.cfg has been updated.")
def _update_pythonbrew(self, options, args):
if options.master:
version = 'master'
elif options.develop:
version = 'develop'
else:
version = get_stable_version()
# check for version
if not options.force and Version(version) <= VERSION:
logger.info("You are already running the installed latest version of pythonbrew.")
return
download_url = get_pythonbrew_update_url(version)
if not download_url:
logger.error("`pythonbrew-%s` was not found in pypi." % version)
sys.exit(1)
headinfo = get_headerinfo_from_url(download_url)
content_type = headinfo['content-type']
if not options.master and not options.develop:
if not is_gzip(content_type, Link(download_url).filename):
logger.error("content type should be gzip. content-type:`%s`" % content_type)
sys.exit(1)
filename = "pythonbrew-%s" % version
distname = "%s.tgz" % filename
download_file = os.path.join(PATH_DISTS, distname)
try:
s = Subprocess(shell=True, cwd=PATH_DISTS, print_cmd=False)
logger.info("Extracting %s" % download_path)
s.check_call("tar zxf %s" % download_path)
d = Downloader()
d.download(distname, download_url, download_file)
except:
logger.error("Failed to download. `%s`" % download_url)
sys.exit(1)
extract_dir = os.path.join(PATH_BUILD, filename)
rm_r(extract_dir)
if not extract_downloadfile(content_type, download_file, extract_dir):
sys.exit(1)
try:
logger.info("Installing %s into %s" % (extract_dir, ROOT))
s = Subprocess()
s.check_call([sys.executable, os.path.join(extract_dir,'pythonbrew_install.py'), '--upgrade'])
except:
logger.error("Failed to update pythonbrew.")
sys.exit(1)
for name in os.listdir(PATH_DISTS):
if _re.match(name):
try:
installer_path = "%s/%s" % (PATH_DISTS, name)
s = Subprocess(shell=True, cwd=PATH_DISTS, print_cmd=False)
logger.info("Installing %s into %s" % (installer_path, ROOT))
s.check_call("%s %s/pythonbrew_install.py" % (sys.executable, installer_path))
except:
logger.error("Failed to update pythonbrew.")
sys.exit(1)
break
logger.info("The pythonbrew has been updated.")
UpdateCommand()
+34
View File
@@ -0,0 +1,34 @@
import os
import sys
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS, PATH_HOME_ETC_TEMP
from pythonbrew.util import Package
from pythonbrew.log import logger
class UseCommand(Command):
name = "use"
usage = "%prog VERSION"
summary = "Use the specified python in current shell"
def run_command(self, options, args):
if not args:
self.parser.print_help()
sys.exit(1)
pkg = Package(args[0])
pkgname = pkg.name
pkgdir = os.path.join(PATH_PYTHONS, pkgname)
if not os.path.isdir(pkgdir):
logger.error("`%s` is not installed." % pkgname)
sys.exit(1)
pkgbin = os.path.join(pkgdir,'bin')
self._set_temp(pkgbin)
logger.info("Using `%s`" % pkgname)
def _set_temp(self, path):
fp = open(PATH_HOME_ETC_TEMP, 'w')
fp.write('PATH_PYTHONBREW_TEMP="%s"\n' % (path))
fp.close()
UseCommand()
+164
View File
@@ -0,0 +1,164 @@
import os
import sys
from pythonbrew.basecommand import Command
from pythonbrew.define import PATH_PYTHONS, PATH_VENVS, PATH_HOME_ETC_VENV,\
PATH_ETC, VIRTUALENV_DLSITE, PATH_DISTS
from pythonbrew.util import Package, \
is_installed, get_installed_pythons_pkgname, get_using_python_pkgname,\
untar_file, Subprocess, rm_r
from pythonbrew.log import logger
from pythonbrew.downloader import Downloader
class VenvCommand(Command):
name = "venv"
usage = "%prog [create|use|delete|list] [project]"
summary = "Create isolated python environments"
def __init__(self):
super(VenvCommand, self).__init__()
self.parser.add_option(
"-p", "--python",
dest="python",
default=None,
help="Use the specified version of python.",
metavar='VERSION'
)
self.parser.add_option(
"-a", "--all",
dest="all",
action='store_true',
default=False,
help="Show the all python environments.",
)
self.parser.add_option(
"-n", "--no-site-packages",
dest="no_site_packages",
action='store_true',
default=False,
help="Don't give access to the global site-packages dir to the virtual environment.",
)
self._venv_dir = os.path.join(PATH_ETC, 'virtualenv')
self._venv = os.path.join(self._venv_dir, 'virtualenv.py')
def run_command(self, options, args):
if not args:
self.parser.print_help()
sys.exit(1)
cmd = args[0]
if not cmd in ('init', 'create', 'delete', 'use', 'list'):
self.parser.print_help()
sys.exit(1)
# initialize?
if cmd == 'init':
self.run_command_init()
return
# target python interpreter
if options.python:
pkgname = Package(options.python).name
if not is_installed(pkgname):
logger.error('%s is not installed.' % pkgname)
sys.exit(1)
else:
# check using python under pythonbrew
pkgname = get_using_python_pkgname()
if not pkgname:
logger.error('Can not use venv command before switching a python. Try \'pythonbrew switch <version of python>\'.')
sys.exit(1)
self._pkgname = pkgname
self._target_py = os.path.join(PATH_PYTHONS, pkgname, 'bin', 'python')
self._workon_home = os.path.join(PATH_VENVS, pkgname)
self._py = os.path.join(PATH_PYTHONS, pkgname, 'bin', 'python')
# is already installed virtualenv?
if not os.path.exists(self._venv):
self.run_command_init()
# Create a shell script
self.__getattribute__('run_command_%s' % cmd)(options, args)
def run_command_init(self):
if os.path.exists(self._venv):
logger.info('venv command is already initialized.')
return
if not os.access(PATH_DISTS, os.W_OK):
logger.error("Can not initialize venv command: Permission denied.")
sys.exit(1)
d = Downloader()
download_file = os.path.join(PATH_DISTS, 'virtualenv.tar.gz')
d.download('virtualenv.tar.gz', VIRTUALENV_DLSITE, download_file)
logger.info('Extracting virtualenv into %s' % self._venv_dir)
untar_file(download_file, self._venv_dir)
def run_command_create(self, options, args):
if not os.access(PATH_VENVS, os.W_OK):
logger.error("Can not create a virtuale environment in %s.\nPermission denied." % PATH_VENVS)
sys.exit(1)
virtualenv_options = []
if options.no_site_packages:
virtualenv_options.append('--no-site-packages')
for arg in args[1:]:
target_dir = os.path.join(self._workon_home, arg)
logger.info("Creating `%s` environment into %s" % (arg, self._workon_home))
# make command
cmd = [self._py, self._venv, '-p', self._target_py]
cmd.extend(virtualenv_options)
cmd.append(target_dir)
# create environment
s = Subprocess(verbose=True)
s.call(cmd)
def run_command_delete(self, options, args):
for arg in args[1:]:
target_dir = os.path.join(self._workon_home, arg)
if not os.path.isdir(target_dir):
logger.error('%s already does not exist.' % target_dir)
else:
if not os.access(target_dir, os.W_OK):
logger.error("Can not delete %s.\nPermission denied." % target_dir)
continue
logger.info('Deleting `%s` environment in %s' % (arg, self._workon_home))
# make command
rm_r(target_dir)
def run_command_use(self, options, args):
if len(args) < 2:
logger.error("Unrecognized command line argument: ( 'pythonbrew venv use <project>' )")
sys.exit(1)
activate = os.path.join(self._workon_home, args[1], 'bin', 'activate')
if not os.path.exists(activate):
logger.error('`%s` environment already does not exist. Try `pythonbrew venv create %s`.' % (args[1], args[1]))
sys.exit(1)
self._write("""\
echo '# Using `%(arg)s` environment (found in %(workon_home)s)'
echo '# To leave an environment, simply run `deactivate`'
source '%(activate)s'
""" % {'arg': args[1], 'workon_home': self._workon_home, 'activate': activate})
def run_command_list(self, options, args):
if options.all:
for pkgname in get_installed_pythons_pkgname():
workon_home = os.path.join(PATH_VENVS, pkgname)
logger.log("# virtualenv for %(pkgname)s (found in %(workon_home)s)" % {'pkgname': pkgname, 'workon_home': workon_home})
if os.path.isdir(workon_home):
for d in sorted(os.listdir(workon_home)):
if os.path.isdir(os.path.join(workon_home, d)):
logger.log(d)
else:
logger.log("# virtualenv for %(pkgname)s (found in %(workon_home)s)" % {'pkgname': self._pkgname, 'workon_home': self._workon_home})
if os.path.isdir(self._workon_home):
for d in sorted(os.listdir(self._workon_home)):
if os.path.isdir(os.path.join(self._workon_home, d)):
logger.log(d)
def _write(self, src):
fp = open(PATH_HOME_ETC_VENV, 'w')
fp.write(src)
fp.close()
VenvCommand()
+1 -1
View File
@@ -8,6 +8,6 @@ class VersionCommand(Command):
summary = "Show version"
def run_command(self, options, args):
logger.info(VERSION)
logger.log(VERSION)
VersionCommand()
+43
View File
@@ -0,0 +1,43 @@
import sys
import re
import subprocess
from subprocess import Popen, PIPE
from pythonbrew.log import logger
from pythonbrew.util import to_str
from pythonbrew.exceptions import CurlFetchException
class Curl(object):
def __init__(self):
returncode = subprocess.call("command -v curl > /dev/null", shell=True)
if returncode:
logger.log("pythonbrew required curl. curl was not found in your path.")
sys.exit(1)
def read(self, url):
p = Popen("curl -skL %s" % url, stdout=PIPE, shell=True)
p.wait()
if p.returncode:
raise Exception('Failed to read.')
return p.stdout.read()
def readheader(self, url):
p = Popen("curl --head -skL %s" % url, stdout=PIPE, shell=True)
p.wait()
if p.returncode:
raise Exception('Failed to readheader.')
respinfo = {}
for line in p.stdout:
line = to_str(line.strip())
if re.match('^HTTP.*? 200 OK$', line):
break
for line in p.stdout:
line = to_str(line.strip()).split(":", 1)
if len(line) == 2:
respinfo[line[0].strip().lower()] = line[1].strip()
return respinfo
def fetch(self, url, filename):
p = Popen("curl -# -kL %s -o %s" % (url, filename), shell=True)
p.wait()
if p.returncode:
raise CurlFetchException('Failed to fetch.')
+73 -39
View File
@@ -1,62 +1,96 @@
import os
import re
try:
import ConfigParser
except:
import configparser as ConfigParser
VERSION = "0.6"
if os.environ.has_key("PYTHONBREW_ROOT"):
ROOT = os.environ["PYTHONBREW_ROOT"]
else:
ROOT = os.path.join(os.environ["HOME"],".pythonbrew")
# pythonbrew version
VERSION = "1.1"
# pythonbrew installer root path
INSTALLER_ROOT = os.path.dirname(os.path.abspath(__file__))
# Root
# pythonbrew root path
ROOT = os.environ.get("PYTHONBREW_ROOT")
if not ROOT:
ROOT = os.path.join(os.environ["HOME"],".pythonbrew")
# directories
PATH_PYTHONS = os.path.join(ROOT,"pythons")
PATH_BUILD = os.path.join(ROOT,"build")
PATH_DISTS = os.path.join(ROOT,"dists")
PATH_ETC = os.path.join(ROOT,"etc")
PATH_BIN = os.path.join(ROOT,"bin")
PATH_LOG = os.path.join(ROOT,"log")
PATH_VENVS = os.path.join(ROOT, "venvs")
PATH_SCRIPTS = os.path.join(ROOT,"scripts")
PATH_SCRIPTS_PYTHONBREW = os.path.join(PATH_SCRIPTS,"pythonbrew")
PATH_SCRIPTS_PYTHONBREW_COMMANDS = os.path.join(PATH_SCRIPTS_PYTHONBREW,"commands")
PATH_SCRIPTS_PYTHONBREW_INSTALLER = os.path.join(PATH_SCRIPTS_PYTHONBREW,"installer")
PATH_PATCHES = os.path.join(ROOT,"patches")
PATH_PATCHES_ALL = os.path.join(PATH_PATCHES,"all")
PATH_PATCHES_MACOSX = os.path.join(PATH_PATCHES,"macosx")
PATH_PATCHES_MACOSX_PYTHON27 = os.path.join(PATH_PATCHES_MACOSX,"python27")
PATH_PATCHES_MACOSX_PYTHON26 = os.path.join(PATH_PATCHES_MACOSX,"python26")
PATH_PATCHES_MACOSX_PYTHON25 = os.path.join(PATH_PATCHES_MACOSX,"python25")
PATH_PATCHES_MACOSX_PYTHON24 = os.path.join(PATH_PATCHES_MACOSX,"python24")
# file path
PATH_BIN_PYTHONBREW = os.path.join(PATH_BIN,"pythonbrew")
PATH_BIN_PYBREW = os.path.join(PATH_BIN,"pybrew") # pybrew is symlink as pythonbrew
# files
PATH_BIN_PYTHONBREW = os.path.join(PATH_BIN,'pythonbrew')
PATH_ETC_CONFIG = os.path.join(PATH_ETC,'config.cfg')
# download setuptools url
DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py"
# Home
# pythonbrew home path
PATH_HOME = os.environ.get('PYTHONBREW_HOME')
if not PATH_HOME:
PATH_HOME = os.path.join(os.environ["HOME"],".pythonbrew")
# download pythonbrew url
PYTHONBREW_UPDATE_URL = {
"head": "http://github.com/utahta/pythonbrew/tarball/master",
"0.5": "https://github.com/utahta/pythonbrew/tarball/0.5",
}
PYTHONBREW_DIRNAME = "utahta-pythonbrew"
# directories
PATH_HOME_ETC = os.path.join(PATH_HOME, 'etc')
# download Python package url
PYTHON_PACKAGE_URL = {}
PYTHON_PACKAGE_URL["1.5.2"] = "http://www.python.org/ftp/python/src/py152.tgz"
PYTHON_PACKAGE_URL["1.6.1"] = "http://www.python.org/download/releases/1.6.1/Python-1.6.1.tar.gz"
_PYTHON_PACKAGE_VERSIONS = [
"2.0", "2.0.1",
"2.1", "2.1.1", "2.1.2", "2.1.3",
"2.2", "2.2.1", "2.2.2", "2.2.3",
"2.3", "2.3.1", "2.3.2", "2.3.4", "2.3.5", "2.3.6", "2.3.7",
"2.4", "2.4.1", "2.4.2", "2.4.3", "2.4.4", "2.4.5", "2.4.6",
"2.5", "2.5.1", "2.5.2", "2.5.3", "2.5.4", "2.5.5",
"2.6", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6",
"2.7",
"3.0", "3.0.1",
"3.1", "3.1.1", "3.1.2",
]
for version in _PYTHON_PACKAGE_VERSIONS:
PYTHON_PACKAGE_URL[version] = "http://www.python.org/ftp/python/%s/Python-%s.tgz" % (version, version)
del _PYTHON_PACKAGE_VERSIONS
PYTHON_PACKAGE_URL["3.2a1"] = "http://www.python.org/ftp/python/3.2/Python-3.2a1.tgz"
PYTHON_PACKAGE_URL["3.2a2"] = "http://www.python.org/ftp/python/3.2/Python-3.2a2.tgz"
PYTHON_PACKAGE_URL["3.2a3"] = "http://www.python.org/ftp/python/3.2/Python-3.2a3.tgz"
# files
PATH_HOME_ETC_VENV = os.path.join(PATH_HOME_ETC, 'venv.run')
PATH_HOME_ETC_CURRENT = os.path.join(PATH_HOME_ETC,'current')
PATH_HOME_ETC_TEMP = os.path.join(PATH_HOME_ETC,'temp')
# read config.cfg
config = ConfigParser.SafeConfigParser()
config.read([PATH_ETC_CONFIG, os.path.join(INSTALLER_ROOT,'etc','config.cfg')])
def _get_or_default(section, option, default=''):
try:
return config.get(section, option)
except:
return default
# setuptools download
DISTRIBUTE_SETUP_DLSITE = _get_or_default('distribute', 'url')
# buildout bootstrap download
BOOTSTRAP_DLSITE = _get_or_default('bootstrap', 'url')
# virtualenv download
VIRTUALENV_DLSITE = _get_or_default('virtualenv', 'url')
# pythonbrew download
PYTHONBREW_UPDATE_URL_MASTER = _get_or_default('pythonbrew', 'master')
PYTHONBREW_UPDATE_URL_DEVELOP = _get_or_default('pythonbrew', 'develop')
PYTHONBREW_UPDATE_URL_PYPI = _get_or_default('pythonbrew', 'pypi')
PYTHONBREW_UPDATE_URL_CONFIG = _get_or_default('pythonbrew', 'config')
# stable version text
PYTHONBREW_STABLE_VERSION_URL = _get_or_default('pythonbrew', 'stable-version')
# python download
LATEST_VERSIONS_OF_PYTHON = []
PYTHON_VERSION_URL = {}
PYTHON_VERSION_URL["1.5.2"] = _get_or_default('Python-1.5.2', 'url')
PYTHON_VERSION_URL["1.6.1"] = _get_or_default('Python-1.6.1', 'url')
for section in sorted(config.sections()):
m = re.search("^Python-(.*)$", section)
if m:
version = m.group(1)
PYTHON_VERSION_URL[version] = config.get(section, 'url')
if config.has_option(section, 'latest') and config.getboolean(section, 'latest'):
LATEST_VERSIONS_OF_PYTHON.append(version)
+23 -45
View File
@@ -1,53 +1,31 @@
import sys
import urllib
import urllib2
from pythonbrew.util import size_format
from pythonbrew.define import PYTHON_PACKAGE_URL, PYTHONBREW_UPDATE_URL
from pythonbrew.define import PYTHON_VERSION_URL, PYTHONBREW_STABLE_VERSION_URL, \
PYTHONBREW_UPDATE_URL_PYPI, PYTHONBREW_UPDATE_URL_MASTER,\
PYTHONBREW_UPDATE_URL_DEVELOP
from pythonbrew.log import logger
from pythonbrew.curl import Curl
from pythonbrew.util import to_str
def get_response_from_url(url):
try:
resp = urllib2.urlopen(url)
except urllib2.HTTPError, e:
logger.error("HTTP error %s while getting %s" % (e.code))
raise
except IOError, e:
# Typically an FTP error
logger.error("Error %s while getting %s" % (e))
raise
return resp
def get_headerinfo_from_url(url):
c = Curl()
return c.readheader(url)
def get_stable_version():
c = Curl()
return to_str(c.read(PYTHONBREW_STABLE_VERSION_URL).strip())
class Downloader(object):
def __init__(self):
self._msg = ""
self._last_msg = ""
self._bytes = 0.0
def download(self, msg, url, path):
self._msg = msg
self._bytes = 0
urllib.urlretrieve(url, path, self._download_progress)
print " downloaded."
def _download_progress(self, block, blockbytes, maxbytes):
self._bytes += float(blockbytes)
if self._bytes >= maxbytes:
self._bytes = maxbytes
percent = (self._bytes / maxbytes) * 100
max_size = size_format(maxbytes)
now_size = size_format(self._bytes)
now_msg = "\rDownloading %s (%s): %3i%% %s" % (self._msg, max_size, percent, now_size)
padding = " " * (len(self._last_msg) - len(now_msg))
sys.stdout.write("%s%s" % (now_msg, padding))
sys.stdout.flush()
self._last_msg = now_msg
logger.info("Downloading %s as %s" % (msg, path))
c = Curl()
c.fetch(url, path)
def get_pythonbrew_update_url(version):
if PYTHONBREW_UPDATE_URL.has_key(version):
return PYTHONBREW_UPDATE_URL[version]
return None
if version == "master":
return PYTHONBREW_UPDATE_URL_MASTER
elif version == 'develop':
return PYTHONBREW_UPDATE_URL_DEVELOP
else:
return PYTHONBREW_UPDATE_URL_PYPI % (version)
def get_python_package_url(version):
if PYTHON_PACKAGE_URL.has_key(version):
return PYTHON_PACKAGE_URL[version]
return None
def get_python_version_url(version):
return PYTHON_VERSION_URL.get(version)
+138
View File
@@ -0,0 +1,138 @@
# settings
PATH_ROOT="$PYTHONBREW_ROOT"
if [ -z "${PATH_ROOT}" ] ; then
PATH_ROOT="$HOME/.pythonbrew"
fi
PATH_ETC="$PATH_ROOT/etc"
PATH_HOME="$PYTHONBREW_HOME"
if [ -z "${PATH_HOME}" ] ; then
PATH_HOME="$HOME/.pythonbrew"
fi
PATH_HOME_ETC="$PATH_HOME/etc"
# py file
PY_PYTHONBREW="$PATH_ROOT/bin/pythonbrew"
# functions
__pythonbrew_set_default()
{
PATH_PYTHONBREW="$PATH_ROOT/bin"
}
__pythonbrew_set_path()
{
PATH_WITHOUT_PYTHONBREW=$(printf $PATH | awk -v RS=: -v ORS=: "/${PATH_ROOT//\//\/}/ {next} {print}" | sed -e 's#:$##')
export PATH=$PATH_PYTHONBREW:$PATH_WITHOUT_PYTHONBREW
}
__pythonbrew_set_temp_path()
{
if [[ -s "$PATH_HOME_ETC/temp" ]] ; then
source "$PATH_HOME_ETC/temp"
PATH_PYTHONBREW="$PATH_ROOT/bin:$PATH_PYTHONBREW_TEMP"
else
__pythonbrew_set_default
fi
__pythonbrew_set_path
}
__pythonbrew_set_current_path()
{
if [[ -s "$PATH_HOME_ETC/current" ]] ; then
source "$PATH_HOME_ETC/current"
PATH_PYTHONBREW="$PATH_ROOT/bin:$PATH_PYTHONBREW_CURRENT"
else
__pythonbrew_set_default
fi
__pythonbrew_set_path
}
__pythonbrew_reload()
{
[[ -s "$PATH_ETC/bashrc" ]] && source "$PATH_ETC/bashrc"
}
__pythonbrew_use()
{
$pythonbrew "$@"
[[ $? == 0 ]] && __pythonbrew_set_temp_path
}
__pythonbrew_switch()
{
$pythonbrew "$@"
[[ $? == 0 ]] && __pythonbrew_set_current_path
}
__pythonbrew_off()
{
$pythonbrew "$@"
[[ $? == 0 ]] && __pythonbrew_set_current_path
}
__pythonbrew_update()
{
$pythonbrew "$@"
[[ $? == 0 ]] && __pythonbrew_reload
}
__pythonbrew_venv()
{
$pythonbrew "$@"
if [[ $? == 0 ]] ; then
if [[ -s "$PATH_HOME_ETC/venv.run" ]] ; then
source "$PATH_HOME_ETC/venv.run"
cat /dev/null > "$PATH_HOME_ETC/venv.run"
fi
fi
}
__pythonbrew_find_command()
{
command_name=""
for arg in "$@" ; do
case $arg in
--*) continue;;
-*) continue;;
*)
command_name=$arg
break
;;
esac
done
}
__pythonbrew_run()
{
__pythonbrew_find_command "$@"
case $command_name in
use) __pythonbrew_use "$@";;
switch) __pythonbrew_switch "$@" ;;
off) __pythonbrew_off "$@" ;;
update) __pythonbrew_update "$@" ;;
venv) __pythonbrew_venv "$@" ;;
*) $pythonbrew "$@" ;;
esac
builtin hash -r
}
pythonbrew()
{
pythonbrew=$PY_PYTHONBREW
__pythonbrew_run "$@"
}
pybrew()
{
pythonbrew "$@"
}
sudopybrew()
{
pythonbrew="sudo PYTHONBREW_ROOT=$PATH_ROOT PATH=$PATH_PYTHONBREW:$PATH_WITHOUT_PYTHONBREW $PY_PYTHONBREW"
__pythonbrew_run "$@"
}
# main
__pythonbrew_set_current_path
+187
View File
@@ -0,0 +1,187 @@
[distribute]
url = http://python-distribute.org/distribute_setup.py
[bootstrap]
url = http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py
[virtualenv]
url = http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.6.4.tar.gz
[pythonbrew]
master = https://github.com/utahta/pythonbrew/tarball/master
develop = https://github.com/utahta/pythonbrew/tarball/develop
pypi = http://pypi.python.org/packages/source/p/pythonbrew/pythonbrew-%%s.tar.gz
stable-version = https://github.com/utahta/pythonbrew/raw/master/stable-version.txt
config = https://github.com/utahta/pythonbrew/raw/master/pythonbrew/etc/config.cfg
[Python-1.5.2]
url = http://www.python.org/ftp/python/src/py152.tgz
latest = True
[Python-1.6.1]
url = http://www.python.org/download/releases/1.6.1/Python-1.6.1.tar.gz
latest = True
[Python-2.0]
url = http://www.python.org/ftp/python/2.0/Python-2.0.tgz
[Python-2.0.1]
url = http://www.python.org/ftp/python/2.0.1/Python-2.0.1.tgz
latest = True
[Python-2.1]
url = http://www.python.org/ftp/python/2.1/Python-2.1.tgz
[Python-2.1.1]
url = http://www.python.org/ftp/python/2.1.1/Python-2.1.1.tgz
[Python-2.1.2]
url = http://www.python.org/ftp/python/2.1.2/Python-2.1.2.tgz
[Python-2.1.3]
url = http://www.python.org/ftp/python/2.1.3/Python-2.1.3.tgz
latest = True
[Python-2.2]
url = http://www.python.org/ftp/python/2.2/Python-2.2.tgz
[Python-2.2.1]
url = http://www.python.org/ftp/python/2.2.1/Python-2.2.1.tgz
[Python-2.2.2]
url = http://www.python.org/ftp/python/2.2.2/Python-2.2.2.tgz
[Python-2.2.3]
url = http://www.python.org/ftp/python/2.2.3/Python-2.2.3.tgz
latest = True
[Python-2.3]
url = http://www.python.org/ftp/python/2.3/Python-2.3.tgz
[Python-2.3.1]
url = http://www.python.org/ftp/python/2.3.1/Python-2.3.1.tgz
[Python-2.3.2]
url = http://www.python.org/ftp/python/2.3.2/Python-2.3.2.tgz
[Python-2.3.4]
url = http://www.python.org/ftp/python/2.3.4/Python-2.3.4.tgz
[Python-2.3.5]
url = http://www.python.org/ftp/python/2.3.5/Python-2.3.5.tgz
[Python-2.3.6]
url = http://www.python.org/ftp/python/2.3.6/Python-2.3.6.tgz
[Python-2.3.7]
url = http://www.python.org/ftp/python/2.3.7/Python-2.3.7.tgz
latest = True
[Python-2.4]
url = http://www.python.org/ftp/python/2.4/Python-2.4.tgz
[Python-2.4.1]
url = http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tgz
[Python-2.4.2]
url = http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tgz
[Python-2.4.3]
url = http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tgz
[Python-2.4.4]
url = http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tgz
[Python-2.4.5]
url = http://www.python.org/ftp/python/2.4.5/Python-2.4.5.tgz
[Python-2.4.6]
url = http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tgz
latest = True
[Python-2.5]
url = http://www.python.org/ftp/python/2.5/Python-2.5.tgz
[Python-2.5.1]
url = http://www.python.org/ftp/python/2.5.1/Python-2.5.1.tgz
[Python-2.5.2]
url = http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
[Python-2.5.3]
url = http://www.python.org/ftp/python/2.5.3/Python-2.5.3.tgz
[Python-2.5.4]
url = http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz
[Python-2.5.5]
url = http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tgz
[Python-2.5.6]
url = http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
latest = True
[Python-2.6]
url = http://www.python.org/ftp/python/2.6/Python-2.6.tgz
[Python-2.6.1]
url = http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tgz
[Python-2.6.2]
url = http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tgz
[Python-2.6.3]
url = http://www.python.org/ftp/python/2.6.3/Python-2.6.3.tgz
[Python-2.6.4]
url = http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz
[Python-2.6.5]
url = http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tgz
[Python-2.6.6]
url = http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
[Python-2.6.7]
url = http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tgz
latest = True
[Python-2.7]
url = http://www.python.org/ftp/python/2.7/Python-2.7.tgz
[Python-2.7.1]
url = http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
[Python-2.7.2]
url = http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
latest = True
[Python-3.0]
url = http://www.python.org/ftp/python/3.0/Python-3.0.tgz
[Python-3.0.1]
url = http://www.python.org/ftp/python/3.0.1/Python-3.0.1.tgz
latest = True
[Python-3.1]
url = http://www.python.org/ftp/python/3.1/Python-3.1.tgz
[Python-3.1.1]
url = http://www.python.org/ftp/python/3.1.1/Python-3.1.1.tgz
[Python-3.1.2]
url = http://www.python.org/ftp/python/3.1.2/Python-3.1.2.tgz
[Python-3.1.3]
url = http://www.python.org/ftp/python/3.1.3/Python-3.1.3.tgz
[Python-3.1.4]
url = http://www.python.org/ftp/python/3.1.4/Python-3.1.4.tgz
latest = True
[Python-3.2]
url = http://www.python.org/ftp/python/3.2/Python-3.2.tgz
[Python-3.2.1]
url = http://www.python.org/ftp/python/3.2.1/Python-3.2.1.tgz
latest = True
+13
View File
@@ -1,3 +1,16 @@
class BuildingException(Exception):
"""General exception during building"""
class ShellCommandException(Exception):
"""General exception during shell command"""
class UnknownVersionException(Exception):
"""General exception during installing"""
class AlreadyInstalledException(Exception):
"""General exception during installing"""
class NotSupportedVersionException(Exception):
"""General exception during installing"""
class CurlFetchException(Exception):
"""Exception curl during fetching"""
-241
View File
@@ -1,241 +0,0 @@
import os
import sys
import glob
import shutil
import re
from pythonbrew.util import makedirs, symlink, Package, is_url, splitext, Link,\
unlink, is_gzip, is_html, untar_file, Subprocess, rm_r,\
is_macosx_snowleopard, is_python25, is_python24, is_python26
from pythonbrew.define import PATH_BUILD, PATH_BIN, PATH_DISTS, PATH_PYTHONS,\
PATH_ETC, PATH_SCRIPTS, PATH_SCRIPTS_PYTHONBREW,\
PATH_SCRIPTS_PYTHONBREW_COMMANDS, INSTALLER_ROOT, PATH_BIN_PYTHONBREW,\
PATH_BIN_PYBREW, ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE, PATH_PATCHES,\
PATH_PATCHES_MACOSX_PYTHON25, PATH_PATCHES_MACOSX_PYTHON24
from pythonbrew.downloader import get_python_package_url, Downloader,\
get_response_from_url
from pythonbrew.log import logger
def install_pythonbrew():
makedirs(PATH_PYTHONS)
makedirs(PATH_BUILD)
makedirs(PATH_DISTS)
makedirs(PATH_ETC)
makedirs(PATH_BIN)
makedirs(PATH_LOG)
makedirs(PATH_SCRIPTS)
makedirs(PATH_SCRIPTS_PYTHONBREW)
makedirs(PATH_SCRIPTS_PYTHONBREW_COMMANDS)
for path in glob.glob(os.path.join(INSTALLER_ROOT,"*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW)
for path in glob.glob(os.path.join(INSTALLER_ROOT,"commands","*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_COMMANDS)
rm_r(PATH_PATCHES)
shutil.copytree(os.path.join(INSTALLER_ROOT,"patches"), PATH_PATCHES)
fp = open("%s/pythonbrew_main.py" % PATH_SCRIPTS, "w")
fp.write("""import pythonbrew
if __name__ == "__main__":
pythonbrew.main()
""")
fp.close()
fp = open(PATH_BIN_PYTHONBREW, "w")
fp.write("""#!/usr/bin/env bash
%s %s/pythonbrew_main.py "$@"
""" % (sys.executable, PATH_SCRIPTS))
fp.close()
os.chmod(PATH_BIN_PYTHONBREW, 0755)
symlink(PATH_BIN_PYTHONBREW, PATH_BIN_PYBREW) # pyb as pythonbrew
os.system("echo 'export PATH=%s/bin:%s/current/bin:${PATH}' > %s/bashrc" % (ROOT, PATH_PYTHONS, PATH_ETC))
os.system("echo 'setenv PATH %s/bin:%s/current/bin:$PATH' > %s/cshrc" % (ROOT, PATH_PYTHONS, PATH_ETC))
class PythonInstaller(object):
def __init__(self, arg, options):
if is_url(arg):
self.download_url = arg
filename = Link(self.download_url).filename
pkg = Package(splitext(filename)[0])
else:
pkg = Package(arg)
self.download_url = get_python_package_url(pkg.version)
if not self.download_url:
logger.error("Unknown package: `%s`" % pkg.name)
sys.exit(1)
filename = Link(self.download_url).filename
self.pkg = pkg
self.install_dir = "%s/%s" % (PATH_PYTHONS, pkg.name)
self.build_dir = "%s/%s" % (PATH_BUILD, pkg.name)
self.download_file = "%s/%s" % (PATH_DISTS, filename)
resp = get_response_from_url(self.download_url)
self.content_type = resp.info()['content-type']
self.options = options
self.logfile = "%s/build.log" % PATH_LOG
def install(self):
if os.path.isdir(self.install_dir):
logger.info("You are already installed `%s`" % self.pkg.name)
sys.exit()
self.ensure()
self.download()
logger.info("")
logger.info("This could take a while. You can run the following command on another shell to track the status:")
logger.info(" tail -f %s" % self.logfile)
logger.info("")
self.unpack()
self.patch()
logger.info("Installing %s into %s" % (self.pkg.name, self.install_dir))
try:
self.configure()
self.make()
self.make_install()
except:
rm_r(self.install_dir)
logger.error("Failed to install %s. See %s to see why." % (self.pkg.name, self.logfile))
logger.info(" pythonbrew install --force %s" % self.pkg.version)
sys.exit(1)
self.install_setuptools()
logger.info("Installed %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
% {"pkgname":self.pkg.name})
logger.info("")
logger.info(" pythonbrew switch %s" % self.pkg.version)
def ensure(self):
if is_macosx_snowleopard():
version = self.pkg.version
if version < '2.6' and (version != '2.4.6' and version != '2.5.5'):
logger.info("`%s` is not supported on MacOSX Snow Leopard" % self.pkg.name)
sys.exit()
def download(self):
content_type = self.content_type
if is_html(content_type):
logger.error("Invalid content-type: `%s`" % content_type)
sys.exit(1)
if os.path.isfile(self.download_file):
logger.info("Use the previously fetched %s" % (self.download_file))
return
msg = Link(self.download_url).show_msg
try:
dl = Downloader()
dl.download(
msg,
self.download_url,
self.download_file
)
except:
unlink(self.download_file)
logger.info("\nInterrupt to abort. `%s`" % (self.download_url))
sys.exit(1)
def unpack(self):
logger.info("Extracting %s" % os.path.basename(self.download_file))
if is_gzip(self.content_type, self.download_file):
untar_file(self.download_file, self.build_dir)
else:
logger.error("Cannot determine archive format of %s" % self.download_file)
def patch(self):
version = self.pkg.version
try:
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
patches = []
if is_macosx_snowleopard():
if is_python24(version):
patch_dir = os.path.join(PATH_PATCHES_MACOSX_PYTHON24,'files')
patches = ['patch-configure', 'patch-Makefile.pre.in',
'patch-Lib-cgi.py', 'patch-Lib-site.py',
'patch-setup.py', 'patch-Include-pyport.h',
'patch-Mac-OSX-Makefile.in', 'patch-Mac-OSX-IDLE-Makefile.in',
'patch-Mac-OSX-PythonLauncher-Makefile.in', 'patch-configure-badcflags.diff',
'patch-configure-arch_only.diff', 'patch-macosmodule.diff',
'patch-mactoolboxglue.diff', 'patch-pymactoolbox.diff']
elif is_python25(version):
patch_dir = os.path.join(PATH_PATCHES_MACOSX_PYTHON25,'files')
patches = ['patch-Makefile.pre.in.diff', 'patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff', 'patch-setup.py.diff',
'patch-configure-badcflags.diff', 'patch-configure-arch_only.diff',
'patch-64bit.diff', 'patch-pyconfig.h.in.diff',
'patch-Modules-posixmodule.c.diff']
if patches:
logger.info("Patching %s" % self.pkg.name)
for patch in patches:
s.check_call("patch -p0 < %s" % os.path.join(patch_dir, patch))
except:
logger.error("Failed to patch `%s`" % self.build_dir)
sys.exit(1)
def configure(self):
configure_option = ""
if is_macosx_snowleopard():
version = self.pkg.version
if is_python24(version):
configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6 CPPFLAGS="-D__DARWIN_UNIX03"'
elif is_python25(version):
configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6 CPPFLAGS="-D_DARWIN_C_SOURCE"'
elif is_python26(version):
configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6'
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
s.check_call("./configure --prefix=%s %s %s" % (self.install_dir, self.options.configure, configure_option))
def make(self):
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
if self.options.force:
s.check_call("make")
else:
s.check_call("make")
s.check_call("make test")
def make_install(self):
version = self.pkg.version
if version == "1.5.2" or version == "1.6.1":
makedirs(self.install_dir)
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
s.check_call("make install")
def install_setuptools(self):
options = self.options
pkgname = self.pkg.name
if options.no_setuptools:
logger.info("Skip installation setuptools.")
return
if re.match("^Python-3.*", pkgname):
is_python3 = True
else:
is_python3 = False
download_url = DISTRIBUTE_SETUP_DLSITE
filename = Link(download_url).filename
download_file = os.path.join(PATH_DISTS, filename)
dl = Downloader()
dl.download(filename, download_url, download_file)
install_dir = os.path.join(PATH_PYTHONS, pkgname)
if is_python3:
if os.path.isfile("%s/bin/python3" % (install_dir)):
pyexec = "%s/bin/python3" % (install_dir)
elif os.path.isfile("%s/bin/python3.0" % (install_dir)):
pyexec = "%s/bin/python3.0" % (install_dir)
else:
logger.error("Python3 binary not found. `%s`" % (install_dir))
return
else:
pyexec = os.path.join(install_dir,"bin","python")
try:
s = Subprocess(log=self.logfile, shell=True, cwd=PATH_DISTS, print_cmd=False)
logger.info("Installing distribute into %s" % install_dir)
s.check_call("%s %s" % (pyexec, filename))
if os.path.isfile("%s/bin/easy_install" % (install_dir)) and not is_python3:
logger.info("Installing pip into %s" % install_dir)
s.check_call("%s/bin/easy_install pip" % (install_dir), cwd=None)
except:
logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
logger.info("Skip install setuptools.")
+62
View File
@@ -0,0 +1,62 @@
from pythonbrew.installer.pythonbrewinstaller import PythonbrewInstaller
from pythonbrew.log import logger
from pythonbrew.define import INSTALLER_ROOT, ROOT, PATH_ETC
def install_pythonbrew():
PythonbrewInstaller.install(INSTALLER_ROOT)
# for bash
shrc = yourshrc = "bashrc"
logger.log("""
Well-done! Congratulations!
The pythonbrew is installed as:
%(ROOT)s
Please add the following line to the end of your ~/.%(yourshrc)s
source %(PATH_ETC)s/%(shrc)s
After that, exit this shell, start a new one, and install some fresh
pythons:
pythonbrew install 2.7.2
pythonbrew install 3.2
For further instructions, run:
pythonbrew help
The default help messages will popup and tell you what to do!
Enjoy pythonbrew at %(ROOT)s!!
""" % {'ROOT':ROOT, 'yourshrc':yourshrc, 'shrc':shrc, 'PATH_ETC':PATH_ETC})
def upgrade_pythonbrew():
PythonbrewInstaller.install(INSTALLER_ROOT)
def systemwide_pythonbrew():
PythonbrewInstaller.install(INSTALLER_ROOT)
PythonbrewInstaller.systemwide_install()
logger.log("""
Well-done! Congratulations!
The pythonbrew is installed as:
%(ROOT)s
After that, exit this shell, start a new one, and install some fresh
pythons:
pythonbrew install 2.7.2
pythonbrew install 3.2
For further instructions, run:
pythonbrew help
The default help messages will popup and tell you what to do!
Enjoy pythonbrew at %(ROOT)s!!
""" % {'ROOT':ROOT})
+109
View File
@@ -0,0 +1,109 @@
import os
import sys
import glob
import shutil
from pythonbrew.util import makedirs, rm_r
from pythonbrew.define import PATH_BUILD, PATH_BIN, PATH_DISTS, PATH_PYTHONS,\
PATH_ETC, PATH_SCRIPTS, PATH_SCRIPTS_PYTHONBREW,\
PATH_SCRIPTS_PYTHONBREW_COMMANDS, PATH_BIN_PYTHONBREW,\
PATH_LOG, PATH_PATCHES, PATH_ETC_CONFIG,\
PATH_SCRIPTS_PYTHONBREW_INSTALLER, PATH_VENVS, PATH_HOME_ETC, ROOT
import stat
import time
class PythonbrewInstaller(object):
"""pythonbrew installer:
"""
@staticmethod
def install(installer_root):
# create directories
makedirs(PATH_PYTHONS)
makedirs(PATH_BUILD)
makedirs(PATH_DISTS)
makedirs(PATH_ETC)
makedirs(PATH_BIN)
makedirs(PATH_LOG)
makedirs(PATH_VENVS)
makedirs(PATH_HOME_ETC)
# create script directories
rm_r(PATH_SCRIPTS)
makedirs(PATH_SCRIPTS)
makedirs(PATH_SCRIPTS_PYTHONBREW)
makedirs(PATH_SCRIPTS_PYTHONBREW_COMMANDS)
makedirs(PATH_SCRIPTS_PYTHONBREW_INSTALLER)
# copy all .py files
for path in glob.glob(os.path.join(installer_root,"*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW)
for path in glob.glob(os.path.join(installer_root,"commands","*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_COMMANDS)
for path in glob.glob(os.path.join(installer_root,"installer","*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_INSTALLER)
# create patches direcotry
rm_r(PATH_PATCHES)
shutil.copytree(os.path.join(installer_root,"patches"), PATH_PATCHES)
# create a main file
fp = open("%s/pythonbrew_main.py" % PATH_SCRIPTS, "w")
fp.write("""import pythonbrew
if __name__ == "__main__":
pythonbrew.main()
""")
fp.close()
# create entry point file
fp = open(PATH_BIN_PYTHONBREW, "w")
fp.write("""#!/usr/bin/env bash
%s %s/pythonbrew_main.py "$@"
""" % (sys.executable, PATH_SCRIPTS))
fp.close()
# mode 0755
os.chmod(PATH_BIN_PYTHONBREW, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH)
# create a bashrc for pythonbrew
shutil.copy(os.path.join(installer_root,'etc','bashrc'), os.path.join(PATH_ETC,'bashrc'))
# copy config.cfg
shutil.copy(os.path.join(installer_root,'etc','config.cfg'), PATH_ETC_CONFIG)
@staticmethod
def systemwide_install():
profile = """\
#begin-pythonbrew
if [ -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" ] ; then
export PYTHONBREW_ROOT=%(root)s
source "${PYTHONBREW_ROOT}/etc/bashrc"
fi
#end-pythonbrew
""" % {'root': ROOT}
if os.path.isdir('/etc/profile.d'):
fp = open('/etc/profile.d/pythonbrew.sh', 'w')
fp.write(profile)
fp.close()
elif os.path.isfile('/etc/profile'):
# create backup
shutil.copy('/etc/profile', '/tmp/profile.pythonbrew.%s' % int(time.time()))
output = []
is_copy = True
fp = open('/etc/profile', 'r')
for line in fp:
if line.startswith('#begin-pythonbrew'):
is_copy = False
continue
elif line.startswith('#end-pythonbrew'):
is_copy = True
continue
if is_copy:
output.append(line)
fp.close()
output.append(profile)
fp = open('/etc/profile', 'w')
fp.write(''.join(output))
fp.close()
+330
View File
@@ -0,0 +1,330 @@
import os
import sys
import shutil
import mimetypes
import re
from pythonbrew.util import makedirs, symlink, Package, is_url, Link,\
unlink, is_html, Subprocess, rm_r,\
is_python25, is_python24, is_python26, is_python27,\
extract_downloadfile, is_archive_file, path_to_fileurl, is_file,\
fileurl_to_path, is_python30, is_python31, is_python32,\
get_macosx_deployment_target, Version
from pythonbrew.define import PATH_BUILD, PATH_DISTS, PATH_PYTHONS,\
ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE,\
PATH_PATCHES_MACOSX_PYTHON25, PATH_PATCHES_MACOSX_PYTHON24,\
PATH_PATCHES_MACOSX_PYTHON26, PATH_PATCHES_MACOSX_PYTHON27, PATH_PATCHES_ALL
from pythonbrew.downloader import get_python_version_url, Downloader,\
get_headerinfo_from_url
from pythonbrew.log import logger
from pythonbrew.exceptions import UnknownVersionException,\
NotSupportedVersionException
class PythonInstaller(object):
"""Python installer
"""
def __init__(self, arg, options):
if is_archive_file(arg):
name = path_to_fileurl(arg)
elif os.path.isdir(arg):
name = path_to_fileurl(arg)
else:
name = arg
if is_url(name):
self.download_url = name
filename = Link(self.download_url).filename
pkg = Package(filename, options.alias)
else:
pkg = Package(name, options.alias)
self.download_url = get_python_version_url(pkg.version)
if not self.download_url:
logger.error("Unknown python version: `%s`" % pkg.name)
raise UnknownVersionException
filename = Link(self.download_url).filename
self.pkg = pkg
self.install_dir = os.path.join(PATH_PYTHONS, pkg.name)
self.build_dir = os.path.join(PATH_BUILD, pkg.name)
self.download_file = os.path.join(PATH_DISTS, filename)
self.options = options
self.logfile = os.path.join(PATH_LOG, 'build.log')
self.patches = []
if Version(self.pkg.version) >= '3.1':
self.configure_options = ['--with-computed-gotos']
else:
self.configure_options = []
def install(self):
# cleanup
if os.path.isdir(self.build_dir):
shutil.rmtree(self.build_dir)
# get content type.
if is_file(self.download_url):
path = fileurl_to_path(self.download_url)
self.content_type = mimetypes.guess_type(path)[0]
else:
headerinfo = get_headerinfo_from_url(self.download_url)
self.content_type = headerinfo['content-type']
if is_html(self.content_type):
# note: maybe got 404 or 503 http status code.
logger.error("Invalid content-type: `%s`" % self.content_type)
return
if os.path.isdir(self.install_dir):
logger.info("You are already installed `%s`" % self.pkg.name)
return
self.download_and_extract()
logger.info("\nThis could take a while. You can run the following command on another shell to track the status:")
logger.info(" tail -f %s\n" % self.logfile)
self.patch()
logger.info("Installing %s into %s" % (self.pkg.name, self.install_dir))
try:
self.configure()
self.make()
self.make_install()
except:
rm_r(self.install_dir)
logger.error("Failed to install %s. See %s to see why." % (self.pkg.name, self.logfile))
logger.log(" pythonbrew install --force %s" % self.pkg.version)
sys.exit(1)
self.symlink()
self.install_setuptools()
logger.info("\nInstalled %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
% {"pkgname":self.pkg.name})
logger.info(" pythonbrew switch %s" % self.pkg.alias)
def download_and_extract(self):
if is_file(self.download_url):
path = fileurl_to_path(self.download_url)
if os.path.isdir(path):
logger.info('Copying %s into %s' % (path, self.build_dir))
shutil.copytree(path, self.build_dir)
return
if os.path.isfile(self.download_file):
logger.info("Use the previously fetched %s" % (self.download_file))
else:
base_url = Link(self.download_url).base_url
try:
dl = Downloader()
dl.download(base_url, self.download_url, self.download_file)
except:
unlink(self.download_file)
logger.error("Failed to download.\n%s" % (sys.exc_info()[1]))
sys.exit(1)
# extracting
if not extract_downloadfile(self.content_type, self.download_file, self.build_dir):
sys.exit(1)
def patch(self):
version = Version(self.pkg.version)
# for ubuntu 11.04(Natty)
if is_python24(version):
patch_dir = os.path.join(PATH_PATCHES_ALL, "python24")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
elif is_python25(version):
patch_dir = os.path.join(PATH_PATCHES_ALL, "python25")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
elif is_python26(version):
patch_dir = os.path.join(PATH_PATCHES_ALL, "common")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
elif is_python27(version):
if version < '2.7.2':
patch_dir = os.path.join(PATH_PATCHES_ALL, "common")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
elif is_python30(version):
patch_dir = os.path.join(PATH_PATCHES_ALL, "python30")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
elif is_python31(version):
if version < '3.1.4':
patch_dir = os.path.join(PATH_PATCHES_ALL, "common")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
elif is_python32(version):
if version == '3.2':
patch_dir = os.path.join(PATH_PATCHES_ALL, "python32")
self._add_patches_to_list(patch_dir, ['patch-setup.py.diff'])
self._do_patch()
def _do_patch(self):
try:
s = Subprocess(log=self.logfile, cwd=self.build_dir, verbose=self.options.verbose)
if self.patches:
logger.info("Patching %s" % self.pkg.name)
for patch in self.patches:
if type(patch) is dict:
for (ed, source) in patch.items():
s.shell('ed - %s < %s' % (source, ed))
else:
s.shell("patch -p0 < %s" % patch)
except:
logger.error("Failed to patch `%s`.\n%s" % (self.build_dir, sys.exc_info()[1]))
sys.exit(1)
def _add_patches_to_list(self, patch_dir, patch_files):
for patch in patch_files:
if type(patch) is dict:
tmp = patch
patch = {}
for key in tmp.keys():
patch[os.path.join(patch_dir, key)] = tmp[key]
self.patches.append(patch)
else:
self.patches.append(os.path.join(patch_dir, patch))
def configure(self):
s = Subprocess(log=self.logfile, cwd=self.build_dir, verbose=self.options.verbose)
cmd = "./configure --prefix=%s %s %s" % (self.install_dir, self.options.configure, ' '.join(self.configure_options))
if self.options.verbose:
logger.log(cmd)
s.check_call(cmd)
def make(self):
jobs = self.options.jobs
make = ((jobs > 0 and 'make -j%s' % jobs) or 'make')
s = Subprocess(log=self.logfile, cwd=self.build_dir, verbose=self.options.verbose)
s.check_call(make)
if not self.options.no_test:
if self.options.force:
# note: ignore tests failure error.
s.call("make test")
else:
s.check_call("make test")
def make_install(self):
version = Version(self.pkg.version)
if version == "1.5.2" or version == "1.6.1":
makedirs(self.install_dir)
s = Subprocess(log=self.logfile, cwd=self.build_dir, verbose=self.options.verbose)
s.check_call("make install")
def symlink(self):
install_dir = os.path.realpath(self.install_dir)
if self.options.framework:
# create symlink bin -> /path/to/Frameworks/Python.framework/Versions/?.?/bin
bin_dir = os.path.join(install_dir, 'bin')
if os.path.exists(bin_dir):
rm_r(bin_dir)
m = re.match(r'\d\.\d', self.pkg.version)
if m:
version = m.group(0)
symlink(os.path.join(install_dir,'Frameworks','Python.framework','Versions',version,'bin'),
os.path.join(bin_dir))
path_python = os.path.join(install_dir,'bin','python')
if not os.path.isfile(path_python):
src = None
for d in os.listdir(os.path.join(install_dir,'bin')):
if re.match(r'python\d\.\d', d):
src = d
break
if src:
path_src = os.path.join(install_dir,'bin',src)
symlink(path_src, path_python)
def install_setuptools(self):
options = self.options
pkgname = self.pkg.name
if options.no_setuptools:
logger.log("Skip installation of setuptools.")
return
download_url = DISTRIBUTE_SETUP_DLSITE
filename = Link(download_url).filename
download_file = os.path.join(PATH_DISTS, filename)
dl = Downloader()
dl.download(filename, download_url, download_file)
install_dir = os.path.join(PATH_PYTHONS, pkgname)
path_python = os.path.join(install_dir,"bin","python")
try:
s = Subprocess(log=self.logfile, cwd=PATH_DISTS, verbose=self.options.verbose)
logger.info("Installing distribute into %s" % install_dir)
s.check_call([path_python, filename])
# installing pip
easy_install = os.path.join(install_dir, 'bin', 'easy_install')
if os.path.isfile(easy_install):
logger.info("Installing pip into %s" % install_dir)
s.check_call([easy_install, 'pip'])
except:
logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
logger.log("Skip installation of setuptools.")
class PythonInstallerMacOSX(PythonInstaller):
"""Python installer for MacOSX
"""
def __init__(self, arg, options):
super(PythonInstallerMacOSX, self).__init__(arg, options)
# check for version
version = Version(self.pkg.version)
if version < '2.6' and (version != '2.4.6' and version < '2.5.5'):
logger.error("`%s` is not supported on MacOSX Snow Leopard" % self.pkg.name)
raise NotSupportedVersionException
# set configure options
target = get_macosx_deployment_target()
if target:
self.configure_options.append('MACOSX_DEPLOYMENT_TARGET=%s' % target)
# set build options
if options.framework and options.static:
logger.error("Can't specify both framework and static.")
raise Exception
if options.framework:
self.configure_options.append('--enable-framework=%s' % os.path.join(self.install_dir, 'Frameworks'))
elif not options.static:
self.configure_options.append('--enable-shared')
if options.universal:
self.configure_options.append('--enable-universalsdk=/')
self.configure_options.append('--with-universal-archs=intel')
# note: skip `make test` to avoid hanging test_threading.
if is_python25(version) or is_python24(version):
self.options.no_test = True
def patch(self):
# note: want an interface to the source patching functionality. like a patchperl.
version = Version(self.pkg.version)
if is_python24(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON24
self._add_patches_to_list(patch_dir, ['patch-configure', 'patch-Makefile.pre.in',
'patch-Lib-cgi.py.diff', 'patch-Lib-site.py.diff',
'patch-setup.py.diff', 'patch-Include-pyport.h',
'patch-Mac-OSX-Makefile.in', 'patch-Mac-OSX-IDLE-Makefile.in',
'patch-Mac-OSX-PythonLauncher-Makefile.in', 'patch-configure-badcflags.diff',
'patch-configure-arch_only.diff', 'patch-macosmodule.diff',
'patch-mactoolboxglue.diff', 'patch-pymactoolbox.diff',
'patch-gestaltmodule.c.diff'])
elif is_python25(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON25
self._add_patches_to_list(patch_dir, ['patch-Makefile.pre.in.diff',
'patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff',
'patch-setup.py.diff',
'patch-configure-badcflags.diff',
'patch-configure-arch_only.diff',
'patch-64bit.diff',
'patch-pyconfig.h.in.diff',
'patch-gestaltmodule.c.diff',
{'_localemodule.c.ed': 'Modules/_localemodule.c'},
{'locale.py.ed': 'Lib/locale.py'}])
elif is_python26(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON26
self._add_patches_to_list(patch_dir, ['patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff',
'patch-Mac-IDLE-Makefile.in.diff',
'patch-Mac-Makefile.in.diff',
'patch-Mac-PythonLauncher-Makefile.in.diff',
'patch-Mac-Tools-Doc-setup.py.diff',
'patch-setup.py-db46.diff',
'patch-Lib-ctypes-macholib-dyld.py.diff',
'patch-setup_no_tkinter.py.diff',
{'_localemodule.c.ed': 'Modules/_localemodule.c'},
{'locale.py.ed': 'Lib/locale.py'}])
elif is_python27(version):
patch_dir = PATH_PATCHES_MACOSX_PYTHON27
self._add_patches_to_list(patch_dir, ['patch-Modules-posixmodule.diff'])
self._do_patch()
+35 -35
View File
@@ -1,43 +1,43 @@
import sys
import logging
class LoggerInfo(object):
def log(self, level, msg, *arg, **keys):
sys.stdout.write("%s\n" % msg)
class LoggerError(object):
def log(self, level, msg, *arg, **keys):
sys.stderr.write("ERROR: %s\n" % msg)
class Logger(object):
class Color(object):
DEBUG = '\033[35m'
INFO = '\033[32m'
ERROR = '\033[31m'
ENDC = '\033[0m'
DEBUG = logging.DEBUG
INFO = logging.INFO
ERROR = logging.ERROR
@classmethod
def _deco(cls, msg, color):
return '%s%s%s' % (color, msg, cls.ENDC)
def __init__(self):
self._consumers = []
consumer = LoggerInfo()
self.add_consumer(Logger.INFO, consumer)
@classmethod
def debug(cls, msg):
return cls._deco(msg, cls.DEBUG)
@classmethod
def info(cls, msg):
return cls._deco(msg, cls.INFO)
@classmethod
def error(cls, msg):
return cls._deco(msg, cls.ERROR)
class Logger(object):
def debug(self, msg):
self._stdout(Color.debug("DEBUG: %s\n" % msg))
def log(self, msg):
self._stdout("%s\n" % (msg))
def info(self, msg):
self._stdout(Color.info('%s\n' % msg))
consumer = LoggerError()
self.add_consumer(Logger.ERROR, consumer)
def debug(self, msg, *args, **keys):
self._log(Logger.DEBUG, msg, *args, **keys)
def info(self, msg, *args, **keys):
self._log(Logger.INFO, msg, *args, **keys)
def error(self, msg):
self._stderr(Color.error("ERROR: %s\n" % msg))
def error(self, msg, *args, **keys):
self._log(Logger.ERROR, msg, *args, **keys)
def _log(self, level, msg, *args, **keys):
for (consumer_level, consumer) in self._consumers:
if level == consumer_level:
consumer.log(level, msg, *args, **keys)
def add_consumer(self, level, consumer):
self._consumers.append((level, consumer))
def _stdout(self, msg):
sys.stdout.write(msg)
sys.stdout.flush()
def _stderr(self, msg):
sys.stderr.write(msg)
sys.stderr.flush()
logger = Logger()
@@ -0,0 +1,47 @@
# HG changeset patch
# User Barry Warsaw <barry@python.org>
# Date 1302190091 14400
# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa
# Parent 2e4cdaffe493e879fb5367a4aa454491de451137
Backport for Python 2.7 of issue 11715 support for building Python on
multiarch Debian/Ubuntu.
diff --git a/setup.py b/setup.py
--- setup.py.orig
+++ setup.py
@@ -345,10 +345,33 @@ class PyBuildExt(build_ext):
return platform
return sys.platform
+ def add_multiarch_paths(self):
+ # Debian/Ubuntu multiarch support.
+ # https://wiki.ubuntu.com/MultiarchSpec
+ if not find_executable('dpkg-architecture'):
+ return
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+ ret = os.system(
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
+ tmpfile)
+ try:
+ if ret >> 8 == 0:
+ with open(tmpfile) as fp:
+ multiarch_path_component = fp.readline().strip()
+ add_dir_to_list(self.compiler.library_dirs,
+ '/usr/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ '/usr/include/' + multiarch_path_component)
+ finally:
+ os.unlink(tmpfile)
+
def detect_modules(self):
# Ensure that /usr/local is always used
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -0,0 +1,45 @@
--- setup.py.orig 2011-07-07 19:19:43.800122463 +0900
+++ setup.py 2011-07-07 19:25:04.548416377 +0900
@@ -13,6 +13,7 @@
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.command.install_lib import install_lib
+from distutils.spawn import find_executable
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []
@@ -242,10 +243,34 @@
return platform
return sys.platform
+ def add_multiarch_paths(self):
+ # Debian/Ubuntu multiarch support.
+ # https://wiki.ubuntu.com/MultiarchSpec
+ if not find_executable('dpkg-architecture'):
+ return
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+ ret = os.system(
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
+ tmpfile)
+ try:
+ if ret >> 8 == 0:
+ fp = open(tmpfile)
+ multiarch_path_component = fp.readline().strip()
+ fp.close()
+ add_dir_to_list(self.compiler.library_dirs,
+ '/usr/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ '/usr/include/' + multiarch_path_component)
+ finally:
+ os.unlink(tmpfile)
+
def detect_modules(self):
# Ensure that /usr/local is always used
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -0,0 +1,45 @@
--- setup.py.orig 2011-07-07 19:19:43.800122463 +0900
+++ setup.py 2011-07-07 19:25:04.548416377 +0900
@@ -13,6 +13,7 @@
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.command.install_lib import install_lib
+from distutils.spawn import find_executable
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []
@@ -242,10 +243,34 @@
return platform
return sys.platform
+ def add_multiarch_paths(self):
+ # Debian/Ubuntu multiarch support.
+ # https://wiki.ubuntu.com/MultiarchSpec
+ if not find_executable('dpkg-architecture'):
+ return
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+ ret = os.system(
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
+ tmpfile)
+ try:
+ if ret >> 8 == 0:
+ fp = open(tmpfile)
+ multiarch_path_component = fp.readline().strip()
+ fp.close()
+ add_dir_to_list(self.compiler.library_dirs,
+ '/usr/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ '/usr/include/' + multiarch_path_component)
+ finally:
+ os.unlink(tmpfile)
+
def detect_modules(self):
# Ensure that /usr/local is always used
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -0,0 +1,44 @@
--- setup.py.orig 2011-07-07 19:41:48.610196111 +0900
+++ setup.py 2011-07-07 19:46:44.986310031 +0900
@@ -14,6 +14,7 @@
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.command.install_lib import install_lib
+from distutils.spawn import find_executable
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []
@@ -308,10 +309,33 @@
return platform
return sys.platform
+ def add_multiarch_paths(self):
+ # Debian/Ubuntu multiarch support.
+ # https://wiki.ubuntu.com/MultiarchSpec
+ if not find_executable('dpkg-architecture'):
+ return
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+ ret = os.system(
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
+ tmpfile)
+ try:
+ if ret >> 8 == 0:
+ with open(tmpfile) as fp:
+ multiarch_path_component = fp.readline().strip()
+ add_dir_to_list(self.compiler.library_dirs,
+ '/usr/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ '/usr/include/' + multiarch_path_component)
+ finally:
+ os.unlink(tmpfile)
+
def detect_modules(self):
# Ensure that /usr/local is always used
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -0,0 +1,38 @@
--- setup.py.orig 2011-07-07 20:26:15.000000000 +0900
+++ setup.py 2011-07-07 20:29:28.735543350 +0900
@@ -370,12 +370,35 @@
return platform
return sys.platform
+ def add_multiarch_paths(self):
+ # Debian/Ubuntu multiarch support.
+ # https://wiki.ubuntu.com/MultiarchSpec
+ if not find_executable('dpkg-architecture'):
+ return
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+ ret = os.system(
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
+ tmpfile)
+ try:
+ if ret >> 8 == 0:
+ with open(tmpfile) as fp:
+ multiarch_path_component = fp.readline().strip()
+ add_dir_to_list(self.compiler.library_dirs,
+ '/usr/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ '/usr/include/' + multiarch_path_component)
+ finally:
+ os.unlink(tmpfile)
+
def detect_modules(self):
# Ensure that /usr/local is always used, but the local build
# directories (i.e. '.' and 'Include') must be first. See issue
# 10520.
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -1,11 +0,0 @@
K 25
svn:wc:ra_dav:version-url
V 62
/repository/macports/!svn/ver/70279/trunk/dports/lang/python24
END
Portfile
K 25
svn:wc:ra_dav:version-url
V 71
/repository/macports/!svn/ver/70279/trunk/dports/lang/python24/Portfile
END
@@ -1,65 +0,0 @@
10
dir
73430
http://svn.macports.org/repository/macports/trunk/dports/lang/python24
http://svn.macports.org/repository/macports
2010-08-04T15:01:11.022285Z
70279
macsforever2000@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
files
dir
Portfile
file
2010-11-13T14:51:11.000000Z
780457d62169f841a63f0da05f70d918
2010-08-04T15:01:11.022285Z
70279
macsforever2000@macports.org
has-props
8580
@@ -1,9 +0,0 @@
K 13
svn:eol-style
V 6
native
K 12
svn:keywords
V 2
Id
END
@@ -1,203 +0,0 @@
# $Id$
PortSystem 1.0
PortGroup select 1.0
name python24
version 2.4.6
revision 7
set major [lindex [split $version .] 0]
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers fourdigits.nl:roel openmaintainer
description An interpreted, object-oriented programming language
long_description Python is an interpreted, interactive, object-oriented \
programming language.
homepage http://www.python.org/
master_sites ${homepage}/ftp/python/${version}/ \
ftp://ftp.python.org/pub/python/${version}/ \
ftp://ftp.fastorama.com/mirrors/ftp.python.org/pub/python/${version}/ \
ftp://ftp.python.jp/pub/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 76083277f6c7e4d78992f36d7ad9018d \
sha1 cb1972a554a458f6a26d3e047b359251865d7c96 \
rmd160 0687989193dec2ac108142759281be7ddcf7f31e
patchfiles patch-configure \
patch-Makefile.pre.in \
patch-Lib-cgi.py \
patch-Lib-site.py \
patch-setup.py \
patch-Include-pyport.h \
patch-Mac-OSX-Makefile.in \
patch-Mac-OSX-IDLE-Makefile.in \
patch-Mac-OSX-PythonLauncher-Makefile.in \
patch-configure-badcflags.diff \
patch-configure-arch_only.diff
depends_lib port:gettext port:openssl
configure.args --with-cxx=${configure.cxx} \
--enable-shared \
--enable-framework=${frameworks_dir} \
--mandir=${prefix}/share/man \
--without-readline \
--disable-tk \
--enable-ipv6
use_parallel_build no
post-patch {
reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
${worksrcpath}/Lib/site.py ${worksrcpath}/setup.py
reinplace "s|__FRAMEWORKS_DIR__|${frameworks_dir}|g" \
${worksrcpath}/Mac/OSX/Makefile.in
reinplace "s|__APPLICATIONS_DIR__|${applications_dir}|g" \
${worksrcpath}/Mac/OSX/IDLE/Makefile.in \
${worksrcpath}/Mac/OSX/Makefile.in \
${worksrcpath}/Mac/OSX/PythonLauncher/Makefile.in
}
build.target all
# Workaround for case-sensitive file systems
post-build {
if { ![file exists ${worksrcpath}/python.exe] } {
ln -s python ${worksrcpath}/python.exe
}
}
test.run yes
test.target test
destroot.target frameworkinstall maninstall
select.group python
select.file ${filespath}/python[string map {. {}} ${branch}]
platform macosx {
if {(![variant_isset universal] && ![string match *64* $build_arch]) || ([variant_isset universal] && ![string match *64* $universal_archs])} {
post-destroot {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
foreach dir { lib include } {
file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir}
ln -s ${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch}
}
# Since the lib/python${branch} dir was just moved above and
# libpython2.4.a in lib/python${branch}/config is relative, we need
# to repoint it here
file delete ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py } {
file delete ${destroot}${prefix}/bin/${bin}
}
foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py] {
file rename -force ${destroot}${framewdir}/bin/${bin} ${destroot}${prefix}/bin
ln -s ${prefix}/bin/${bin} ${destroot}${framewdir}/bin/${bin}
}
foreach dir { Headers Resources Python Versions/Current } {
file delete ${destroot}${framewpath}/${dir}
}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/2.4/Python) which doesn't
# quite work (see ticket #15099); instead specifically list the
# full path to the proper Python framework file (which becomes
# ${prefix}/Library/Frameworks/Python.framework/Versions/2.4/Python)
reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${prefix}/lib/python${branch}/config/Makefile
}
} else {
# 64-bit, can't build mac-specific stuff
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue
destroot.target install maninstall
post-destroot {
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# install select file for python_select
xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
}
}
}
notes "To fully complete your installation and make python $branch the default, please run:
\tsudo port install python_select
\tsudo python_select $name"
platform darwin {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D__DARWIN_UNIX03
post-configure {
reinplace "s|#define _POSIX_C_SOURCE 200112L|#undef _POSIX_C_SOURCE|g" ${worksrcpath}/pyconfig.h
reinplace "s|#define _XOPEN_SOURCE 600|#undef _XOPEN_SOURCE|g" ${worksrcpath}/pyconfig.h
patchfiles-append patch-macosmodule.diff \
patch-mactoolboxglue.diff \
patch-pymactoolbox.diff
}
}
platform puredarwin {
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue --disable-framework
destroot.target install maninstall
post-destroot {
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# install select file for python_select
xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
}
}
variant universal {
if {${configure.sdkroot} != ""} {
configure.args-append --enable-universalsdk=${configure.sdkroot}
} else {
configure.args-append --enable-universalsdk=/
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
-203
View File
@@ -1,203 +0,0 @@
# $Id: Portfile 70279 2010-08-04 15:01:11Z macsforever2000@macports.org $
PortSystem 1.0
PortGroup select 1.0
name python24
version 2.4.6
revision 7
set major [lindex [split $version .] 0]
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers fourdigits.nl:roel openmaintainer
description An interpreted, object-oriented programming language
long_description Python is an interpreted, interactive, object-oriented \
programming language.
homepage http://www.python.org/
master_sites ${homepage}/ftp/python/${version}/ \
ftp://ftp.python.org/pub/python/${version}/ \
ftp://ftp.fastorama.com/mirrors/ftp.python.org/pub/python/${version}/ \
ftp://ftp.python.jp/pub/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 76083277f6c7e4d78992f36d7ad9018d \
sha1 cb1972a554a458f6a26d3e047b359251865d7c96 \
rmd160 0687989193dec2ac108142759281be7ddcf7f31e
patchfiles patch-configure \
patch-Makefile.pre.in \
patch-Lib-cgi.py \
patch-Lib-site.py \
patch-setup.py \
patch-Include-pyport.h \
patch-Mac-OSX-Makefile.in \
patch-Mac-OSX-IDLE-Makefile.in \
patch-Mac-OSX-PythonLauncher-Makefile.in \
patch-configure-badcflags.diff \
patch-configure-arch_only.diff
depends_lib port:gettext port:openssl
configure.args --with-cxx=${configure.cxx} \
--enable-shared \
--enable-framework=${frameworks_dir} \
--mandir=${prefix}/share/man \
--without-readline \
--disable-tk \
--enable-ipv6
use_parallel_build no
post-patch {
reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
${worksrcpath}/Lib/site.py ${worksrcpath}/setup.py
reinplace "s|__FRAMEWORKS_DIR__|${frameworks_dir}|g" \
${worksrcpath}/Mac/OSX/Makefile.in
reinplace "s|__APPLICATIONS_DIR__|${applications_dir}|g" \
${worksrcpath}/Mac/OSX/IDLE/Makefile.in \
${worksrcpath}/Mac/OSX/Makefile.in \
${worksrcpath}/Mac/OSX/PythonLauncher/Makefile.in
}
build.target all
# Workaround for case-sensitive file systems
post-build {
if { ![file exists ${worksrcpath}/python.exe] } {
ln -s python ${worksrcpath}/python.exe
}
}
test.run yes
test.target test
destroot.target frameworkinstall maninstall
select.group python
select.file ${filespath}/python[string map {. {}} ${branch}]
platform macosx {
if {(![variant_isset universal] && ![string match *64* $build_arch]) || ([variant_isset universal] && ![string match *64* $universal_archs])} {
post-destroot {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
foreach dir { lib include } {
file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir}
ln -s ${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch}
}
# Since the lib/python${branch} dir was just moved above and
# libpython2.4.a in lib/python${branch}/config is relative, we need
# to repoint it here
file delete ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py } {
file delete ${destroot}${prefix}/bin/${bin}
}
foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py] {
file rename -force ${destroot}${framewdir}/bin/${bin} ${destroot}${prefix}/bin
ln -s ${prefix}/bin/${bin} ${destroot}${framewdir}/bin/${bin}
}
foreach dir { Headers Resources Python Versions/Current } {
file delete ${destroot}${framewpath}/${dir}
}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/2.4/Python) which doesn't
# quite work (see ticket #15099); instead specifically list the
# full path to the proper Python framework file (which becomes
# ${prefix}/Library/Frameworks/Python.framework/Versions/2.4/Python)
reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${prefix}/lib/python${branch}/config/Makefile
}
} else {
# 64-bit, can't build mac-specific stuff
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue
destroot.target install maninstall
post-destroot {
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# install select file for python_select
xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
}
}
}
notes "To fully complete your installation and make python $branch the default, please run:
\tsudo port install python_select
\tsudo python_select $name"
platform darwin {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D__DARWIN_UNIX03
post-configure {
reinplace "s|#define _POSIX_C_SOURCE 200112L|#undef _POSIX_C_SOURCE|g" ${worksrcpath}/pyconfig.h
reinplace "s|#define _XOPEN_SOURCE 600|#undef _XOPEN_SOURCE|g" ${worksrcpath}/pyconfig.h
patchfiles-append patch-macosmodule.diff \
patch-mactoolboxglue.diff \
patch-pymactoolbox.diff
}
}
platform puredarwin {
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue --disable-framework
destroot.target install maninstall
post-destroot {
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# install select file for python_select
xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
}
}
variant universal {
if {${configure.sdkroot} != ""} {
configure.args-append --enable-universalsdk=${configure.sdkroot}
} else {
configure.args-append --enable-universalsdk=/
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
@@ -1,101 +0,0 @@
K 25
svn:wc:ra_dav:version-url
V 68
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files
END
patch-setup.py
K 25
svn:wc:ra_dav:version-url
V 83
/repository/macports/!svn/ver/42379/trunk/dports/lang/python24/files/patch-setup.py
END
patch-pymactoolbox.diff
K 25
svn:wc:ra_dav:version-url
V 92
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files/patch-pymactoolbox.diff
END
patch-Mac-OSX-Makefile.in
K 25
svn:wc:ra_dav:version-url
V 94
/repository/macports/!svn/ver/41218/trunk/dports/lang/python24/files/patch-Mac-OSX-Makefile.in
END
patch-Mac-OSX-PythonLauncher-Makefile.in
K 25
svn:wc:ra_dav:version-url
V 109
/repository/macports/!svn/ver/41218/trunk/dports/lang/python24/files/patch-Mac-OSX-PythonLauncher-Makefile.in
END
python24
K 25
svn:wc:ra_dav:version-url
V 77
/repository/macports/!svn/ver/50424/trunk/dports/lang/python24/files/python24
END
patch-mactoolboxglue.diff
K 25
svn:wc:ra_dav:version-url
V 94
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files/patch-mactoolboxglue.diff
END
patch-configure-badcflags.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/56585/trunk/dports/lang/python24/files/patch-configure-badcflags.diff
END
patch-Lib-cgi.py
K 25
svn:wc:ra_dav:version-url
V 85
/repository/macports/!svn/ver/28753/trunk/dports/lang/python24/files/patch-Lib-cgi.py
END
patch-Lib-site.py
K 25
svn:wc:ra_dav:version-url
V 86
/repository/macports/!svn/ver/21487/trunk/dports/lang/python24/files/patch-Lib-site.py
END
patch-Mac-OSX-IDLE-Makefile.in
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/41218/trunk/dports/lang/python24/files/patch-Mac-OSX-IDLE-Makefile.in
END
patch-configure-arch_only.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/56585/trunk/dports/lang/python24/files/patch-configure-arch_only.diff
END
patch-Include-pyport.h
K 25
svn:wc:ra_dav:version-url
V 91
/repository/macports/!svn/ver/23777/trunk/dports/lang/python24/files/patch-Include-pyport.h
END
patch-Makefile.pre.in
K 25
svn:wc:ra_dav:version-url
V 90
/repository/macports/!svn/ver/44176/trunk/dports/lang/python24/files/patch-Makefile.pre.in
END
pyconfig.ed
K 25
svn:wc:ra_dav:version-url
V 80
/repository/macports/!svn/ver/48185/trunk/dports/lang/python24/files/pyconfig.ed
END
patch-macosmodule.diff
K 25
svn:wc:ra_dav:version-url
V 91
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files/patch-macosmodule.diff
END
patch-configure
K 25
svn:wc:ra_dav:version-url
V 84
/repository/macports/!svn/ver/44176/trunk/dports/lang/python24/files/patch-configure
END
@@ -1,572 +0,0 @@
10
dir
73430
http://svn.macports.org/repository/macports/trunk/dports/lang/python24/files
http://svn.macports.org/repository/macports
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
patch-setup.py
file
2010-11-13T14:51:11.000000Z
5f490b115ab19796bd3af9de6901dd49
2008-11-20T06:13:14.102247Z
42379
blb@macports.org
2219
patch-pymactoolbox.diff
file
2010-11-13T14:51:11.000000Z
789b1776bda064daf576ee30ae56c0d0
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
585
patch-Mac-OSX-Makefile.in
file
2010-11-13T14:51:11.000000Z
62e937496bf0fba58b1413b3b7080950
2008-10-28T06:31:42.726319Z
41218
blb@macports.org
721
patch-Mac-OSX-PythonLauncher-Makefile.in
file
2010-11-13T14:51:11.000000Z
d21904e251b9114c93eaaa23608102e6
2008-10-28T06:31:42.726319Z
41218
blb@macports.org
769
python24
file
2010-11-13T14:51:11.000000Z
aa43cb032d8199431e9f3371fb0d3754
2009-04-30T21:04:30.747761Z
50424
jmr@macports.org
321
patch-mactoolboxglue.diff
file
2010-11-13T14:51:11.000000Z
9101df4cf01c5c8b9eb0192757a01d64
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
733
patch-configure-badcflags.diff
file
2010-11-13T14:51:11.000000Z
0edd3830be4a95c9ef6ace14cac35a36
2009-08-30T16:27:48.203663Z
56585
jmr@macports.org
629
patch-Lib-cgi.py
file
2010-11-13T14:51:11.000000Z
16a1503a53b90c650e5a18ddd3c099ba
2007-09-08T10:37:52.838883Z
28753
afb@macports.org
808
patch-Lib-site.py
file
2010-11-13T14:51:11.000000Z
b3e92b93bc323584d2d50876c9d7d228
2007-01-26T02:45:46.302708Z
21487
eridius@macports.org
550
patch-Mac-OSX-IDLE-Makefile.in
file
2010-11-13T14:51:11.000000Z
75cb1fde28f15bf2219160562fc62592
2008-10-28T06:31:42.726319Z
41218
blb@macports.org
346
patch-configure-arch_only.diff
file
2010-11-13T14:51:11.000000Z
9dbe4e25743af454086d069ca875738b
2009-08-30T16:27:48.203663Z
56585
jmr@macports.org
1019
patch-Include-pyport.h
file
2010-11-13T14:51:11.000000Z
e69c63be534f546dcd3f7d50f6c52bce
2007-04-09T19:13:26.590067Z
23777
mgrimes@macports.org
1331
patch-Makefile.pre.in
file
2010-11-13T14:51:11.000000Z
30784b41f25f887041698ccffa050643
2008-12-23T04:46:09.409745Z
44176
blb@macports.org
345
pyconfig.ed
file
2010-11-13T14:51:11.000000Z
674a4842ff1491cf7669c37d9b0b95bc
2009-03-16T07:42:14.908329Z
48185
blb@macports.org
49
patch-macosmodule.diff
file
2010-11-13T14:51:11.000000Z
8df02cb3c18543f8637eae8cacd51c4a
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
10267
patch-configure
file
2010-11-13T14:51:11.000000Z
44225e6715e9b9e0ed742c56ecba7d86
2008-12-23T04:46:09.409745Z
44176
blb@macports.org
1131
@@ -1,34 +0,0 @@
--- Include/pyport.h.orig 2007-03-12 23:26:06.000000000 -0700
+++ Include/pyport.h 2007-03-12 23:29:35.000000000 -0700
@@ -152,11 +152,23 @@ typedef PY_LONG_LONG Py_intptr_t;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
#include <sys/types.h>
#endif
+
+#if (defined __APPLE__) && (!defined _POSIX_C_SOURCE)
+#define TEMPORARILY_DEFINING__POSIX_C_SOURCE /* so we can #undef it later */
+#define _POSIX_C_SOURCE /* avoid deprecated struct ostat in sys/stat.h */
+#endif
+
#include <sys/stat.h>
#elif defined(HAVE_STAT_H)
#include <stat.h>
#endif
+/* Mac OS X: undefine _POSIX_C_SOURCE if it wasn't defined before */
+#ifdef TEMPORARILY_DEFINING__POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#undef TEMPORARILY_DEFINING__POSIX_C_SOURCE
+#endif
+
#if defined(PYCC_VACPP)
/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
@@ -393,6 +405,7 @@ extern char * _getpty(int *, int, mode_t
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
functions, even though they are included in libutil. */
#include <termios.h>
+struct winsize;
extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
extern int forkpty(int *, char *, struct termios *, struct winsize *);
#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
@@ -1,11 +0,0 @@
--- Mac/OSX/IDLE/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/IDLE/Makefile.in 2007-04-27 13:27:07.000000000 -0700
@@ -21,7 +21,7 @@
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
+PYTHONAPPSDIR=__APPLICATIONS_DIR__/MacPython $(VERSION)
all: IDLE.app
@@ -1,20 +0,0 @@
--- Mac/OSX/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/Makefile.in 2007-04-27 11:07:02.000000000 -0700
@@ -5,7 +5,7 @@
VERSION=@VERSION@
builddir = ../..
srcdir = @srcdir@
-prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
+prefix=__FRAMEWORKS_DIR__/Python.framework/Versions/$(VERSION)
LIBDEST=$(prefix)/lib/python$(VERSION)
BUILDPYTHON=$(builddir)/python.exe
RUNSHARED= @RUNSHARED@
@@ -16,7 +16,7 @@
# These are normally glimpsed from the previous set
bindir=@exec_prefix@/bin
-PYTHONAPPSPATH=/Applications/MacPython $(VERSION)
+PYTHONAPPSPATH=__APPLICATIONS_DIR__/MacPython $(VERSION)
PYTHONAPPSDIR=$(PYTHONAPPSPATH)
APPINSTALLDIR=$(prefix)/Resources/Python.app
@@ -1,20 +0,0 @@
--- Mac/OSX/PythonLauncher/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/PythonLauncher/Makefile.in 2007-04-27 13:33:26.000000000 -0700
@@ -20,7 +20,7 @@
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
+PYTHONAPPSDIR=__APPLICATIONS_DIR__/MacPython $(VERSION)
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
all: PythonLauncher.app
@@ -56,7 +56,7 @@
--resource=$(srcdir)/factorySettings.plist \
--plist=$(srcdir)/Info.plist \
build
- find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r
+ find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r || :
FileSettings.o: $(srcdir)/FileSettings.m
@@ -1,11 +0,0 @@
--- Makefile.pre.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Makefile.pre.in 2007-04-20 18:06:11.000000000 -0700
@@ -56,7 +56,7 @@
OPT= @OPT@
BASECFLAGS= @BASECFLAGS@
CFLAGS= $(BASECFLAGS) $(OPT)
-CPPFLAGS= -I. -I$(srcdir)/Include
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir)/Include
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
SGI_ABI= @SGI_ABI@
@@ -1,20 +0,0 @@
--- configure.orig 2009-08-31 01:54:27.000000000 +1000
+++ configure 2009-08-31 01:55:24.000000000 +1000
@@ -10321,7 +10321,7 @@
Darwin/[01234567].*)
LIBTOOL_CRUFT="-framework System -lcc_dynamic"
if test -z "${enable_universalsdk}"; then
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10333,7 +10333,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only '`/usr/bin/arch`
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -1,14 +0,0 @@
--- configure.orig 2009-08-31 01:29:04.000000000 +1000
+++ configure 2009-08-31 01:30:05.000000000 +1000
@@ -3909,9 +3909,9 @@
Darwin*)
if [[ `/usr/bin/arch` = 'ppc' ]]
then
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+ BASECFLAGS="$BASECFLAGS -mno-fused-madd -fno-common"
else
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+ BASECFLAGS="$BASECFLAGS -fno-common"
fi
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
@@ -1,25 +0,0 @@
--- configure.orig 2007-04-05 21:32:57.000000000 -0700
+++ configure 2007-04-05 21:32:59.000000000 -0700
@@ -3907,7 +3907,12 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ if [[ `/usr/bin/arch` = 'ppc' ]]
+ then
+ BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+ else
+ BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+ fi
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
@@ -10328,7 +10333,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only ppc'
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only '`/usr/bin/arch`
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -1,427 +0,0 @@
--- Mac/Modules/macosmodule.c 2004-11-05 08:02:59.000000000 +0100
+++ Mac/Modules/macosmodule.c 2009-09-05 02:07:14.000000000 +0200
@@ -40,7 +40,7 @@
typedef struct {
PyObject_HEAD
- short fRefNum;
+ FSIORefNum fRefNum;
int isclosed;
} rfobject;
@@ -54,7 +54,7 @@
do_close(rfobject *self)
{
if (self->isclosed ) return;
- (void)FSClose(self->fRefNum);
+ (void)FSCloseFork(self->fRefNum);
self->isclosed = 1;
}
@@ -68,6 +68,7 @@
long n;
PyObject *v;
OSErr err;
+ ByteCount n2;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
@@ -81,13 +82,13 @@
if (v == NULL)
return NULL;
- err = FSRead(self->fRefNum, &n, PyString_AsString(v));
+ err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
if (err && err != eofErr) {
PyMac_Error(err);
Py_DECREF(v);
return NULL;
}
- _PyString_Resize(&v, n);
+ _PyString_Resize(&v, n2);
return v;
}
@@ -109,7 +110,7 @@
}
if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
return NULL;
- err = FSWrite(self->fRefNum, &size, buffer);
+ err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
if (err) {
PyMac_Error(err);
return NULL;
@@ -126,47 +127,36 @@
static PyObject *
rf_seek(rfobject *self, PyObject *args)
{
- long amount, pos;
+ long amount;
int whence = SEEK_SET;
- long eof;
+ int mode;
OSErr err;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
return NULL;
}
- if (!PyArg_ParseTuple(args, "l|i", &amount, &whence))
+ if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) {
return NULL;
-
- if ((err = GetEOF(self->fRefNum, &eof)))
- goto ioerr;
+ }
switch (whence) {
case SEEK_CUR:
- if ((err = GetFPos(self->fRefNum, &pos)))
- goto ioerr;
+ mode = fsFromMark;
break;
case SEEK_END:
- pos = eof;
+ mode = fsFromLEOF;
break;
case SEEK_SET:
- pos = 0;
+ mode = fsFromStart;
break;
default:
PyErr_BadArgument();
return NULL;
}
-
- pos += amount;
-
- /* Don't bother implementing seek past EOF */
- if (pos > eof || pos < 0) {
- PyErr_BadArgument();
- return NULL;
- }
-
- if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
-ioerr:
+
+ err = FSSetForkPosition(self->fRefNum, mode, amount);
+ if (err != noErr) {
PyMac_Error(err);
return NULL;
}
@@ -182,7 +172,7 @@
static PyObject *
rf_tell(rfobject *self, PyObject *args)
{
- long where;
+ long long where;
OSErr err;
if (self->isclosed) {
@@ -191,11 +181,13 @@
}
if (!PyArg_ParseTuple(args, ""))
return NULL;
- if ((err = GetFPos(self->fRefNum, &where)) ) {
+
+ err = FSGetForkPosition(self->fRefNum, &where);
+ if (err != noErr) {
PyMac_Error(err);
return NULL;
}
- return PyInt_FromLong(where);
+ return PyLong_FromLongLong(where);
}
static char rf_close__doc__[] =
@@ -281,6 +273,7 @@
Rftype__doc__ /* Documentation string */
};
+
/* End of code for Resource fork objects */
/* -------------------------------------------------------- */
@@ -292,17 +285,61 @@
static PyObject *
MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
{
- FSSpec fss;
- FInfo info;
PyObject *creator, *type, *res;
OSErr err;
-
- if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+ FSRef ref;
+ FSCatalogInfo cataloginfo;
+ FileInfo* finfo;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) {
+#ifndef __LP64__
+ /* This function is documented to take an FSSpec as well,
+ * which only works in 32-bit mode.
+ */
+ PyErr_Clear();
+ FSSpec fss;
+ FInfo info;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+ return NULL;
+
+ if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
+ return PyErr_Mac(MacOS_Error, err);
+ }
+ creator = PyString_FromStringAndSize(
+ (char *)&info.fdCreator, 4);
+ type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+ res = Py_BuildValue("OO", creator, type);
+ Py_DECREF(creator);
+ Py_DECREF(type);
+ return res;
+#else /* __LP64__ */
+ return NULL;
+#endif /* __LP64__ */
+ }
+
+ err = FSGetCatalogInfo(&ref,
+ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
+ NULL, NULL, NULL);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, err);
return NULL;
- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
- creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4);
- type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+ }
+
+ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+ /* Directory: doesn't have type/creator info.
+ *
+ * The specific error code is for backward compatibility with
+ * earlier versions.
+ */
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+
+ }
+ finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
+ type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);
+
res = Py_BuildValue("OO", creator, type);
Py_DECREF(creator);
Py_DECREF(type);
@@ -314,20 +351,66 @@
static PyObject *
MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
{
- FSSpec fss;
ResType creator, type;
- FInfo info;
+ FSRef ref;
+ FileInfo* finfo;
OSErr err;
-
+ FSCatalogInfo cataloginfo;
+
if (!PyArg_ParseTuple(args, "O&O&O&",
+ PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) {
+#ifndef __LP64__
+ /* Try to handle FSSpec arguments, for backward compatibility */
+ FSSpec fss;
+ FInfo info;
+
+ if (!PyArg_ParseTuple(args, "O&O&O&",
PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
+ return NULL;
+
+ if ((err = FSpGetFInfo(&fss, &info)) != noErr)
+ return PyErr_Mac(MacOS_Error, err);
+
+ info.fdCreator = creator;
+ info.fdType = type;
+
+ if ((err = FSpSetFInfo(&fss, &info)) != noErr)
+ return PyErr_Mac(MacOS_Error, err);
+ Py_INCREF(Py_None);
+ return Py_None;
+#else /* __LP64__ */
return NULL;
- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
- info.fdCreator = creator;
- info.fdType = type;
- if ((err = FSpSetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
+#endif /* __LP64__ */
+ }
+
+ err = FSGetCatalogInfo(&ref,
+ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
+ NULL, NULL, NULL);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, err);
+ return NULL;
+ }
+
+ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+ /* Directory: doesn't have type/creator info.
+ *
+ * The specific error code is for backward compatibility with
+ * earlier versions.
+ */
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+
+ }
+ finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ finfo->fileCreator = creator;
+ finfo->fileType = type;
+
+ err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+ }
+
Py_INCREF(Py_None);
return Py_None;
}
@@ -375,6 +458,7 @@
/* And try again... */
h = GetResource('Estr', err);
}
+ Py_DECREF(m);
}
}
/*
@@ -398,6 +482,9 @@
return Py_BuildValue("s", buf);
}
+
+#ifndef __LP64__
+
static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
static PyObject *
@@ -416,7 +503,7 @@
return NULL;
olddialog = curdialog;
curdialog = NULL;
-
+
if ( resid != -1 ) {
curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
if ( curdialog ) {
@@ -451,11 +538,13 @@
if (!PyArg_ParseTuple(args, "O&|O", PyMac_GetStr255, message, &object))
return NULL;
+
DebugStr(message);
Py_INCREF(Py_None);
return Py_None;
}
+
static char SysBeep_doc[] = "BEEEEEP!!!";
static PyObject *
@@ -470,6 +559,8 @@
return Py_None;
}
+#endif /* __LP64__ */
+
static char WMAvailable_doc[] =
"True if this process can interact with the display."
"Will foreground the application on the first call as a side-effect."
@@ -529,51 +620,37 @@
{
OSErr err;
char *mode = "r";
- FSSpec fss;
- SignedByte permission = 1;
+ FSRef ref;
+ SInt8 permission = fsRdPerm;
rfobject *fp;
+ HFSUniStr255 name;
- if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode))
+ if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
return NULL;
while (*mode) {
switch (*mode++) {
case '*': break;
- case 'r': permission = 1; break;
- case 'w': permission = 2; break;
+ case 'r': permission = fsRdPerm; break;
+ case 'w': permission = fsWrPerm; break;
case 'b': break;
default:
PyErr_BadArgument();
return NULL;
}
}
+
+ err = FSGetResourceForkName(&name);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
if ( (fp = newrfobject()) == NULL )
return NULL;
-
- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
+
- if ( err == fnfErr ) {
- /* In stead of doing complicated things here to get creator/type
- ** correct we let the standard i/o library handle it
- */
- FILE *tfp;
- char pathname[PATHNAMELEN];
-
- if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) {
- PyMac_Error(err);
- Py_DECREF(fp);
- return NULL;
- }
-
- if ( (tfp = fopen(pathname, "w")) == NULL ) {
- PyMac_Error(fnfErr); /* What else... */
- Py_DECREF(fp);
- return NULL;
- }
- fclose(tfp);
- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
- }
- if ( err ) {
+ err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
+ if (err != noErr) {
Py_DECREF(fp);
PyMac_Error(err);
return NULL;
@@ -583,15 +660,18 @@
}
+
static PyMethodDef MacOS_Methods[] = {
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
{"GetErrorString", MacOS_GetErrorString, 1, geterr_doc},
{"openrf", MacOS_openrf, 1, openrf_doc},
+#ifndef __LP64__
{"splash", MacOS_splash, 1, splash_doc},
{"DebugStr", MacOS_DebugStr, 1, DebugStr_doc},
- {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
+#endif /* __LP64__ */
+ {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
{NULL, NULL} /* Sentinel */
};
@@ -1,20 +0,0 @@
--- Python/mactoolboxglue.c 2006-10-08 19:41:25.000000000 +0200
+++ Python/mactoolboxglue.c 2009-09-05 01:25:57.000000000 +0200
@@ -414,7 +414,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
-
+/*
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -427,7 +427,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
-
+*/
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")
GLUE_NEW(Handle, OptResObj_New, "Carbon.Res")
@@ -1,18 +0,0 @@
--- Include/pymactoolbox.h 2004-11-05 08:02:59.000000000 +0100
+++ Include/pymactoolbox.h 2009-09-05 01:26:30.000000000 +0200
@@ -134,6 +134,7 @@
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
/* Qt exports */
+/*
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +147,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+*/
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -1,2 +0,0 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -1,12 +0,0 @@
bin/python2.4
bin/pythonw2.4
-
bin/idle2.4
bin/pydoc2.4
bin/smtpd2.4.py
-
share/man/man1/python2.4.1.gz
${frameworks_dir}/Python.framework/Versions/2.4
${frameworks_dir}/Python.framework/Versions/2.4/Headers
${frameworks_dir}/Python.framework/Versions/2.4/Resources
${frameworks_dir}/Python.framework/Versions/2.4/Python
@@ -1,18 +0,0 @@
--- Lib/cgi.py.orig 2006-08-11 09:14:38.000000000 +0200
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
+#! __PREFIX__/bin/python2.4
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
-# intentionally NOT "/usr/bin/env python". On many systems
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
-# scripts, and /usr/local/bin is the default directory where Python is
-# installed, so /usr/bin/env would be unable to find python. Granted,
-# binary installations by Linux vendors often install Python in
-# /usr/bin. So let those vendors patch cgi.py to match their choice
-# of installation.
+# NOTE: /usr/local/bin/python patched for MacPorts installation
"""Support module for CGI (Common Gateway Interface) scripts.
@@ -1,10 +0,0 @@
--- Lib/site.py Tue Jul 20 04:28:28 2004
+++ Lib/site.py.new Mon Apr 4 10:47:12 2005
@@ -186,6 +186,7 @@
else:
sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
if sys.platform == 'darwin':
+ sitedirs.append( os.path.join('__PREFIX__', 'lib', 'python2.4', 'site-packages') )
# for framework builds *only* we add the standard Apple
# locations. Currently only per-user, but /Library and
# /Network/Library could be added too
@@ -1,46 +0,0 @@
--- setup.py.orig 2006-10-08 11:41:25.000000000 -0600
+++ setup.py 2008-11-19 22:13:50.000000000 -0700
@@ -15,7 +15,7 @@
from distutils.command.install_lib import install_lib
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ["readline"]
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -246,11 +246,11 @@
# Add paths to popular package managers on OS X/darwin
if sys.platform == "darwin":
# Fink installs into /sw by default
- add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
- add_dir_to_list(self.compiler.include_dirs, '/sw/include')
+ #add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
+ #add_dir_to_list(self.compiler.include_dirs, '/sw/include')
# DarwinPorts installs into /opt/local by default
- #add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
- #add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')
+ add_dir_to_list(self.compiler.library_dirs, '__PREFIX__/lib')
+ add_dir_to_list(self.compiler.include_dirs, '__PREFIX__/include')
if os.path.normpath(sys.prefix) != '/usr':
add_dir_to_list(self.compiler.library_dirs,
@@ -357,7 +357,7 @@
exts.append( Extension('unicodedata', ['unicodedata.c']) )
# access to ISO C locale support
data = open('pyconfig.h').read()
- m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data)
+ m = re.search(r"#\s*define\s+(HAVE_LIBINTL_H|WITH_LIBINTL)\s+1\s*", data)
if m is not None:
locale_libs = ['intl']
else:
@@ -954,7 +954,8 @@
self.extensions.extend(exts)
# Call the method for detecting whether _tkinter can be compiled
- self.detect_tkinter(inc_dirs, lib_dirs)
+ if ("--disable-tk" not in sysconfig.get_config_var("CONFIG_ARGS")):
+ self.detect_tkinter(inc_dirs, lib_dirs)
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
# The _tkinter module, using frameworks. Since frameworks are quite
@@ -1,2 +0,0 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -1,12 +0,0 @@
bin/python2.4
bin/pythonw2.4
-
bin/idle2.4
bin/pydoc2.4
bin/smtpd2.4.py
-
share/man/man1/python2.4.1.gz
${frameworks_dir}/Python.framework/Versions/2.4
${frameworks_dir}/Python.framework/Versions/2.4/Headers
${frameworks_dir}/Python.framework/Versions/2.4/Resources
${frameworks_dir}/Python.framework/Versions/2.4/Python
@@ -0,0 +1,19 @@
*** Mac/Modules/gestaltmodule.c 2010-11-21 15:35:00.000000000 +0900
--- Mac/Modules/gestaltmodule.c.new 2010-11-21 15:48:27.000000000 +0900
***************
*** 34,40 ****
{
OSErr iErr;
OSType selector;
! long response;
if (!PyArg_Parse(args, "O&", PyMac_GetOSType, &selector))
return NULL;
iErr = Gestalt ( selector, &response );
--- 34,40 ----
{
OSErr iErr;
OSType selector;
! SInt32 response;
if (!PyArg_Parse(args, "O&", PyMac_GetOSType, &selector))
return NULL;
iErr = Gestalt ( selector, &response );
@@ -1,11 +0,0 @@
K 25
svn:wc:ra_dav:version-url
V 62
/repository/macports/!svn/ver/69520/trunk/dports/lang/python25
END
Portfile
K 25
svn:wc:ra_dav:version-url
V 71
/repository/macports/!svn/ver/69520/trunk/dports/lang/python25/Portfile
END
@@ -1,65 +0,0 @@
10
dir
73426
http://svn.macports.org/repository/macports/trunk/dports/lang/python25
http://svn.macports.org/repository/macports
2010-07-08T20:19:52.476265Z
69520
jmr@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
files
dir
Portfile
file
2010-11-13T11:26:29.000000Z
ca4390c343e6a0ff2dff18fd4e3cc961
2010-07-08T20:19:52.476265Z
69520
jmr@macports.org
has-props
7650
@@ -1,9 +0,0 @@
K 13
svn:eol-style
V 6
native
K 12
svn:keywords
V 2
Id
END
@@ -1,194 +0,0 @@
# $Id$
PortSystem 1.0
PortGroup select 1.0
name python25
version 2.5.5
revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers jwa openmaintainer
description An interpreted, object-oriented programming language
long_description Python is an interpreted, interactive, object-oriented \
programming language.
homepage http://www.python.org/
master_sites http://ftp.python.org/ftp/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 1d00e2fb19418e486c30b850df625aa3 \
sha1 dcf1abd94a1ab4155dcd3668cca42c5bfc81159f \
rmd160 4754238d415142466778560d989582464385654c
# patch-Lib-distutils-dist.py.diff comes from
# <http://bugs.python.org/issue1180>
patchfiles patch-Makefile.pre.in.diff \
patch-Lib-cgi.py.diff \
patch-Lib-distutils-dist.py.diff \
patch-setup.py.diff \
patch-configure-badcflags.diff \
patch-configure-arch_only.diff \
patch-64bit.diff
depends_lib port:gettext port:zlib port:openssl port:tk \
port:sqlite3 port:db46 port:bzip2 \
port:gdbm port:readline port:ncurses
configure.args --enable-shared \
--enable-framework=${frameworks_dir} \
--mandir=${prefix}/share/man \
--enable-ipv6 \
--with-cxx=${configure.cxx}
configure.cppflags-append -I${prefix}/include/ncurses
post-patch {
reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
${worksrcpath}/setup.py
reinplace "s|/Applications/MacPython|${applications_dir}/MacPython|g" \
${worksrcpath}/Mac/Makefile.in \
${worksrcpath}/Mac/IDLE/Makefile.in \
${worksrcpath}/Mac/Tools/Doc/setup.py \
${worksrcpath}/Mac/PythonLauncher/Makefile.in \
${worksrcpath}/Mac/BuildScript/build-installer.py
reinplace "s|xargs -0 rm -r|xargs -0 rm -rf|g" \
${worksrcpath}/Mac/PythonLauncher/Makefile.in
}
build.target all
# TODO: From python24, do we still need this?
# Workaround for case-sensitive file systems
post-build {
if { ![file exists ${worksrcpath}/python.exe] } {
ln -s python ${worksrcpath}/python.exe
}
}
test.run yes
test.target test
destroot.target frameworkinstall maninstall
# ensure that correct compiler is used
build.args-append MAKE="${build.cmd}" CC="${configure.cc}"
destroot.args-append MAKE="${destroot.cmd}" CC="${configure.cc}"
select.group python
select.file ${filespath}/python[string map {. {}} ${branch}]
platform macosx {
post-destroot {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/2.5/Python) which doesn't
# quite work (see ticket #15099); instead specifically list the
# full path to the proper Python framework file (which becomes
# ${prefix}/Library/Frameworks/Python.framework/Versions/2.5/Python)
reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
foreach dir { lib include } {
file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir}
ln -s ${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch}
}
ln -s ${prefix}/share ${destroot}${framewdir}/share
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py python${branch}-config] {
file rename -force ${destroot}${framewdir}/bin/${bin} ${destroot}${prefix}/bin
ln -s ${prefix}/bin/${bin} ${destroot}${framewdir}/bin/${bin}
}
foreach dir { Headers Resources Python Versions/Current } {
file delete ${destroot}${framewpath}/${dir}
}
# Fix incorrectly-pointed libpython2.5.a symlink, see
# http://trac.macports.org/ticket/19906
set python_staticlink ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
file delete ${python_staticlink}
ln -s ${framewdir}/Python ${python_staticlink}
}
}
post-activate {
ui_msg "\nTo fully complete your installation and make python $branch the default, please run
\n\tsudo port install python_select \
\n\tsudo python_select $name\n"
}
platform darwin {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 8 {
patchfiles-append patch-FSIORefNum.diff
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D_DARWIN_C_SOURCE
patchfiles-append patch-pyconfig.h.in.diff
}
platform puredarwin {
patchfiles-append patch-Modules-posixmodule.c.diff
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue --disable-framework
destroot.target install maninstall
post-build {
# thin dynamic library to have the same arch as static lib, even after -lSystemStubs
system "lipo ${worksrcpath}/libpython${branch}.dylib -output ${worksrcpath}/libpython${branch}.dylib -thin `lipo -info ${worksrcpath}/libpython${branch}.a | tail -n 1 | sed -e 's/.*architecture: \\(.*\\)/\\1/'`"
}
post-destroot {
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# install select file for python_select
xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
}
}
configure.universal_archs i386 ppc
variant universal {
if {${configure.sdkroot} == ""} {
configure.args-append --enable-universalsdk=/
} else {
configure.args-append --enable-universalsdk=${configure.sdkroot}
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
-194
View File
@@ -1,194 +0,0 @@
# $Id: Portfile 69520 2010-07-08 20:19:52Z jmr@macports.org $
PortSystem 1.0
PortGroup select 1.0
name python25
version 2.5.5
revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers jwa openmaintainer
description An interpreted, object-oriented programming language
long_description Python is an interpreted, interactive, object-oriented \
programming language.
homepage http://www.python.org/
master_sites http://ftp.python.org/ftp/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 1d00e2fb19418e486c30b850df625aa3 \
sha1 dcf1abd94a1ab4155dcd3668cca42c5bfc81159f \
rmd160 4754238d415142466778560d989582464385654c
# patch-Lib-distutils-dist.py.diff comes from
# <http://bugs.python.org/issue1180>
patchfiles patch-Makefile.pre.in.diff \
patch-Lib-cgi.py.diff \
patch-Lib-distutils-dist.py.diff \
patch-setup.py.diff \
patch-configure-badcflags.diff \
patch-configure-arch_only.diff \
patch-64bit.diff
depends_lib port:gettext port:zlib port:openssl port:tk \
port:sqlite3 port:db46 port:bzip2 \
port:gdbm port:readline port:ncurses
configure.args --enable-shared \
--enable-framework=${frameworks_dir} \
--mandir=${prefix}/share/man \
--enable-ipv6 \
--with-cxx=${configure.cxx}
configure.cppflags-append -I${prefix}/include/ncurses
post-patch {
reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
${worksrcpath}/setup.py
reinplace "s|/Applications/MacPython|${applications_dir}/MacPython|g" \
${worksrcpath}/Mac/Makefile.in \
${worksrcpath}/Mac/IDLE/Makefile.in \
${worksrcpath}/Mac/Tools/Doc/setup.py \
${worksrcpath}/Mac/PythonLauncher/Makefile.in \
${worksrcpath}/Mac/BuildScript/build-installer.py
reinplace "s|xargs -0 rm -r|xargs -0 rm -rf|g" \
${worksrcpath}/Mac/PythonLauncher/Makefile.in
}
build.target all
# TODO: From python24, do we still need this?
# Workaround for case-sensitive file systems
post-build {
if { ![file exists ${worksrcpath}/python.exe] } {
ln -s python ${worksrcpath}/python.exe
}
}
test.run yes
test.target test
destroot.target frameworkinstall maninstall
# ensure that correct compiler is used
build.args-append MAKE="${build.cmd}" CC="${configure.cc}"
destroot.args-append MAKE="${destroot.cmd}" CC="${configure.cc}"
select.group python
select.file ${filespath}/python[string map {. {}} ${branch}]
platform macosx {
post-destroot {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/2.5/Python) which doesn't
# quite work (see ticket #15099); instead specifically list the
# full path to the proper Python framework file (which becomes
# ${prefix}/Library/Frameworks/Python.framework/Versions/2.5/Python)
reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
foreach dir { lib include } {
file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir}
ln -s ${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch}
}
ln -s ${prefix}/share ${destroot}${framewdir}/share
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py python${branch}-config] {
file rename -force ${destroot}${framewdir}/bin/${bin} ${destroot}${prefix}/bin
ln -s ${prefix}/bin/${bin} ${destroot}${framewdir}/bin/${bin}
}
foreach dir { Headers Resources Python Versions/Current } {
file delete ${destroot}${framewpath}/${dir}
}
# Fix incorrectly-pointed libpython2.5.a symlink, see
# http://trac.macports.org/ticket/19906
set python_staticlink ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
file delete ${python_staticlink}
ln -s ${framewdir}/Python ${python_staticlink}
}
}
post-activate {
ui_msg "\nTo fully complete your installation and make python $branch the default, please run
\n\tsudo port install python_select \
\n\tsudo python_select $name\n"
}
platform darwin {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 8 {
patchfiles-append patch-FSIORefNum.diff
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D_DARWIN_C_SOURCE
patchfiles-append patch-pyconfig.h.in.diff
}
platform puredarwin {
patchfiles-append patch-Modules-posixmodule.c.diff
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue --disable-framework
destroot.target install maninstall
post-build {
# thin dynamic library to have the same arch as static lib, even after -lSystemStubs
system "lipo ${worksrcpath}/libpython${branch}.dylib -output ${worksrcpath}/libpython${branch}.dylib -thin `lipo -info ${worksrcpath}/libpython${branch}.a | tail -n 1 | sed -e 's/.*architecture: \\(.*\\)/\\1/'`"
}
post-destroot {
# delete symlinks without version suffix, use python_select instead to choose version
foreach bin { python pythonw idle pydoc smtpd.py python-config } {
file delete ${destroot}${prefix}/bin/${bin}
}
file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
# install select file for python_select
xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
}
}
configure.universal_archs i386 ppc
variant universal {
if {${configure.sdkroot} == ""} {
configure.args-append --enable-universalsdk=/
} else {
configure.args-append --enable-universalsdk=${configure.sdkroot}
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
@@ -0,0 +1,2 @@
g/defined(__APPLE__)/s//0/g
w
@@ -1,89 +0,0 @@
K 25
svn:wc:ra_dav:version-url
V 68
/repository/macports/!svn/ver/60380/trunk/dports/lang/python25/files
END
patch-Misc-setuid-prog.c.diff
K 25
svn:wc:ra_dav:version-url
V 98
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-Misc-setuid-prog.c.diff
END
patch-FSIORefNum.diff
K 25
svn:wc:ra_dav:version-url
V 90
/repository/macports/!svn/ver/57516/trunk/dports/lang/python25/files/patch-FSIORefNum.diff
END
patch-Lib-cgi.py.diff
K 25
svn:wc:ra_dav:version-url
V 90
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-Lib-cgi.py.diff
END
patch-configure-arch_only.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/52864/trunk/dports/lang/python25/files/patch-configure-arch_only.diff
END
patch-Modules-posixmodule.c.diff
K 25
svn:wc:ra_dav:version-url
V 101
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-Modules-posixmodule.c.diff
END
patch-Lib-distutils-dist.py.diff
K 25
svn:wc:ra_dav:version-url
V 101
/repository/macports/!svn/ver/42997/trunk/dports/lang/python25/files/patch-Lib-distutils-dist.py.diff
END
patch-configure.diff
K 25
svn:wc:ra_dav:version-url
V 89
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-configure.diff
END
pyconfig.ed
K 25
svn:wc:ra_dav:version-url
V 80
/repository/macports/!svn/ver/60380/trunk/dports/lang/python25/files/pyconfig.ed
END
python25
K 25
svn:wc:ra_dav:version-url
V 77
/repository/macports/!svn/ver/50424/trunk/dports/lang/python25/files/python25
END
patch-configure-badcflags.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/40837/trunk/dports/lang/python25/files/patch-configure-badcflags.diff
END
patch-Makefile.pre.in.diff
K 25
svn:wc:ra_dav:version-url
V 95
/repository/macports/!svn/ver/43000/trunk/dports/lang/python25/files/patch-Makefile.pre.in.diff
END
patch-setup.py.diff
K 25
svn:wc:ra_dav:version-url
V 88
/repository/macports/!svn/ver/57388/trunk/dports/lang/python25/files/patch-setup.py.diff
END
patch-64bit.diff
K 25
svn:wc:ra_dav:version-url
V 85
/repository/macports/!svn/ver/57388/trunk/dports/lang/python25/files/patch-64bit.diff
END
patch-pyconfig.h.in.diff
K 25
svn:wc:ra_dav:version-url
V 93
/repository/macports/!svn/ver/55669/trunk/dports/lang/python25/files/patch-pyconfig.h.in.diff
END
@@ -1,504 +0,0 @@
10
dir
73426
http://svn.macports.org/repository/macports/trunk/dports/lang/python25/files
http://svn.macports.org/repository/macports
2009-11-10T14:40:06.347802Z
60380
jmr@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
patch-Misc-setuid-prog.c.diff
file
2010-11-13T11:26:29.000000Z
2bc1e6606dde7390fd8240b131bdf4ec
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
410
patch-FSIORefNum.diff
file
2010-11-13T11:26:29.000000Z
8084ec041a99e7cb661772f009df15a7
2009-09-12T06:14:57.000179Z
57516
jmr@macports.org
399
patch-Lib-cgi.py.diff
file
2010-11-13T11:26:29.000000Z
82a8c9d18f4280a8bbb8a6cbf5868a8a
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
808
patch-configure-arch_only.diff
file
2010-11-13T11:26:29.000000Z
14c3bb850c180ab737a46d59bc82d6a0
2009-06-24T22:01:14.810769Z
52864
landonf@macports.org
941
patch-Modules-posixmodule.c.diff
file
2010-11-13T11:26:29.000000Z
10bf449d661c9721211c94b5c3acd7fb
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
571
patch-Lib-distutils-dist.py.diff
file
2010-11-13T11:26:29.000000Z
92eea653ba7debcbfd848b3e95fa664e
2008-12-03T05:16:31.085444Z
42997
blb@macports.org
2050
patch-configure.diff
file
2010-11-13T11:26:29.000000Z
758a0b524c7089e1367b9304628b7f33
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
956
pyconfig.ed
file
2010-11-13T11:26:29.000000Z
674a4842ff1491cf7669c37d9b0b95bc
2009-11-10T14:40:06.347802Z
60380
jmr@macports.org
49
python25
file
2010-11-13T11:26:29.000000Z
00706fcdb40c3ab1242bd33ffcaecf00
2009-04-30T21:04:30.747761Z
50424
jmr@macports.org
340
patch-configure-badcflags.diff
file
2010-11-13T11:26:29.000000Z
0270e74fe78847844dbd13831777d22c
2008-10-16T01:47:43.712585Z
40837
toby@macports.org
460
patch-Makefile.pre.in.diff
file
2010-11-13T11:26:29.000000Z
715099f836a2265992b3b1842f05d2a2
2008-12-03T06:04:11.934031Z
43000
blb@macports.org
1449
patch-setup.py.diff
file
2010-11-13T11:26:29.000000Z
36831c5d2729aee54fe424ba32776ace
2009-09-10T13:23:37.201201Z
57388
jmr@macports.org
3814
patch-64bit.diff
file
2010-11-13T11:26:29.000000Z
5f7cfee7ab539a15e7997224f51e8b97
2009-09-10T13:23:37.201201Z
57388
jmr@macports.org
37004
patch-pyconfig.h.in.diff
file
2010-11-13T11:26:29.000000Z
df5999ec974fbe1a2716a63c882b4639
2009-08-16T18:17:13.357907Z
55669
landonf@macports.org
396
@@ -1,11 +0,0 @@
--- Mac/Modules/file/_Filemodule.c.orig 2009-09-12 15:55:59.000000000 +1000
+++ Mac/Modules/file/_Filemodule.c 2009-09-12 16:12:07.000000000 +1000
@@ -7,6 +7,8 @@
#include "pymactoolbox.h"
+typedef SInt16 FSIORefNum;
+
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \
@@ -1,31 +0,0 @@
--- Makefile.pre.in.orig 2007-12-05 13:43:57.000000000 -0700
+++ Makefile.pre.in 2008-07-25 21:41:02.000000000 -0600
@@ -348,8 +348,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
case $$MAKEFLAGS in \
- *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q --no-user-cfg build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg build;; \
esac
# Build static library
@@ -894,7 +904,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall:
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
@@ -968,7 +978,7 @@
# This installs a few of the useful scripts in Tools/scripts
scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \
- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
+ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py --no-user-cfg install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--root=/$(DESTDIR)
@@ -1,16 +0,0 @@
--- Misc/setuid-prog.c.orig Sat Dec 11 14:29:22 2004
+++ Misc/setuid-prog.c Sat Dec 11 14:30:13 2004
@@ -70,6 +70,12 @@
#define environ _environ
#endif
+#if defined(__APPLE__)
+#include <sys/time.h>
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif
+
/* don't change def_IFS */
char def_IFS[] = "IFS= \t\n";
/* you may want to change def_PATH, but you should really change it in */
@@ -1,20 +0,0 @@
--- configure.orig 2009-06-24 13:57:38.000000000 -0700
+++ configure 2009-06-24 13:58:38.000000000 -0700
@@ -11362,7 +11362,7 @@
if test "${enable_universalsdk}"; then
:
else
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -11374,7 +11374,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -1,11 +0,0 @@
--- configure.orig 2008-10-15 18:00:59.000000000 -0700
+++ configure 2008-10-15 18:02:47.000000000 -0700
@@ -4538,7 +4538,7 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ BASECFLAGS="$BASECFLAGS -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
@@ -1,28 +0,0 @@
--- configure.in.orig 2007-09-28 21:07:32.000000000 +0200
+++ configure.in 2007-09-28 21:08:12.000000000 +0200
@@ -669,6 +669,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
--- configure.orig 2007-09-28 21:07:26.000000000 +0200
+++ configure 2007-09-28 21:07:33.000000000 +0200
@@ -3445,6 +3445,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
@@ -1,13 +0,0 @@
--- pyconfig.h.in.orig 2009-08-16 10:22:50.000000000 -0700
+++ pyconfig.h.in 2009-08-16 10:23:24.000000000 -0700
@@ -4,6 +4,10 @@
#ifndef Py_PYCONFIG_H
#define Py_PYCONFIG_H
+// Required on Darwin 10+
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
support for AIX C++ shared extension modules. */
@@ -1,80 +0,0 @@
--- setup.py.orig 2008-10-16 12:58:19.000000000 -0600
+++ setup.py 2009-06-07 20:55:17.000000000 -0600
@@ -609,7 +609,7 @@
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 5)
+ max_db_ver = (4, 6)
# NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
# we leave that version disabled by default as it has proven to be
# quite a buggy library release on many platforms.
@@ -636,6 +636,7 @@
db_inc_paths.append('/usr/local/include/db4%d' % x)
db_inc_paths.append('/pkg/db-4.%d/include' % x)
db_inc_paths.append('/opt/db-4.%d/include' % x)
+ db_inc_paths.append('__PREFIX__/include/db4%d' % x)
# 3.x minor number specific paths
for x in (3,):
db_inc_paths.append('/usr/include/db3%d' % x)
@@ -711,6 +712,7 @@
# check lib directories parallel to the location of the header
db_dirs_to_check = [
+ os.path.join('__PREFIX__', 'lib', 'db46'),
os.path.join(db_incdir, '..', 'lib64'),
os.path.join(db_incdir, '..', 'lib'),
os.path.join(db_incdir, '..', '..', 'lib64'),
@@ -1212,13 +1214,7 @@
def detect_tkinter(self, inc_dirs, lib_dirs):
# The _tkinter module.
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
platform = self.get_platform()
- if (platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
--- setup.py.orig 2009-09-10 19:41:32.000000000 +1000
+++ setup.py 2009-09-10 19:48:30.000000000 +1000
@@ -1197,7 +1197,7 @@
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ #include_dirs.append('/usr/X11R6/include')
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1262,17 +1262,17 @@
if platform == 'sunos5':
include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
+ #elif os.path.exists('/usr/X11R6/include'):
+ # include_dirs.append('/usr/X11R6/include')
+ # added_lib_dirs.append('/usr/X11R6/lib64')
+ # added_lib_dirs.append('/usr/X11R6/lib')
+ #elif os.path.exists('/usr/X11R5/include'):
+ # include_dirs.append('/usr/X11R5/include')
+ # added_lib_dirs.append('/usr/X11R5/lib')
+ #else:
# Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ # include_dirs.append('/usr/X11/include')
+ # added_lib_dirs.append('/usr/X11/lib')
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -1,2 +0,0 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -1,12 +0,0 @@
bin/python2.5
bin/pythonw2.5
bin/python2.5-config
bin/idle2.5
bin/pydoc2.5
bin/smtpd2.5.py
-
share/man/man1/python2.5.1.gz
${frameworks_dir}/Python.framework/Versions/2.5
${frameworks_dir}/Python.framework/Versions/2.5/Headers
${frameworks_dir}/Python.framework/Versions/2.5/Resources
${frameworks_dir}/Python.framework/Versions/2.5/Python
@@ -1,11 +0,0 @@
--- Mac/Modules/file/_Filemodule.c.orig 2009-09-12 15:55:59.000000000 +1000
+++ Mac/Modules/file/_Filemodule.c 2009-09-12 16:12:07.000000000 +1000
@@ -7,6 +7,8 @@
#include "pymactoolbox.h"
+typedef SInt16 FSIORefNum;
+
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \
@@ -1,16 +0,0 @@
--- Misc/setuid-prog.c.orig Sat Dec 11 14:29:22 2004
+++ Misc/setuid-prog.c Sat Dec 11 14:30:13 2004
@@ -70,6 +70,12 @@
#define environ _environ
#endif
+#if defined(__APPLE__)
+#include <sys/time.h>
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif
+
/* don't change def_IFS */
char def_IFS[] = "IFS= \t\n";
/* you may want to change def_PATH, but you should really change it in */

Some files were not shown because too many files have changed in this diff Show More