sqlobject-cvs Mailing List for SQLObject (Page 21)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
| 2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
| 2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
| 2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
| 2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
| 2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
| 2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
| 2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
| 2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
| 2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
| 2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
| 2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
| 2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
| 2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
| 2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sub...@co...> - 2014-07-22 12:14:07
|
Author: phd Date: Tue Jul 22 06:14:00 2014 New Revision: 4760 Log: Merge revision 4759 from branch 1.7: update News Modified: SQLObject/trunk/docs/News.txt Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Tue Jul 22 06:13:13 2014 (r4759) +++ SQLObject/trunk/docs/News.txt Tue Jul 22 06:14:00 2014 (r4760) @@ -52,6 +52,9 @@ * Python 2.4 is no longer supported. The minimal supported version is Python 2.5. +* Support for Python 2.5 is declared obsolete and will be removed + in the next release. + Minor features -------------- |
|
From: <sub...@co...> - 2014-07-22 12:13:22
|
Author: phd Date: Tue Jul 22 06:13:13 2014 New Revision: 4759 Log: Merge revision 4715 from branch 1.6: update News Modified: SQLObject/branches/1.7/docs/News.txt Modified: SQLObject/branches/1.7/docs/News.txt ============================================================================== --- SQLObject/branches/1.7/docs/News.txt Tue Jul 1 11:33:55 2014 (r4758) +++ SQLObject/branches/1.7/docs/News.txt Tue Jul 22 06:13:13 2014 (r4759) @@ -40,6 +40,9 @@ * Python 2.4 is no longer supported. The minimal supported version is Python 2.5. +* Support for Python 2.5 is declared obsolete and will be removed + in the next release. + Minor features -------------- |
|
From: <sub...@co...> - 2014-07-01 17:34:04
|
Author: phd
Date: Tue Jul 1 11:33:55 2014
New Revision: 4758
Log:
SQLObject 1.7.0b1
Modified:
SQLObject/tags/1.7.0b1/README.txt
SQLObject/tags/1.7.0b1/setup.py
SQLObject/tags/1.7.0b1/sqlobject/__version__.py
Modified: SQLObject/tags/1.7.0b1/README.txt
==============================================================================
--- SQLObject/tags/1.7.0b1/README.txt Tue Jul 1 11:29:21 2014 (r4757)
+++ SQLObject/tags/1.7.0b1/README.txt Tue Jul 1 11:33:55 2014 (r4758)
@@ -1,5 +1,5 @@
-SQLObject 1.7
-=============
+SQLObject 1.7.0b1
+=================
Thanks for looking at SQLObject. SQLObject is an object-relational
mapper, i.e., a library that will wrap your database tables in Python
Modified: SQLObject/tags/1.7.0b1/setup.py
==============================================================================
--- SQLObject/tags/1.7.0b1/setup.py Tue Jul 1 11:29:21 2014 (r4757)
+++ SQLObject/tags/1.7.0b1/setup.py Tue Jul 1 11:33:55 2014 (r4758)
@@ -68,7 +68,7 @@
maintainer="Oleg Broytman",
maintainer_email="ph...@ph...",
url="http://sqlobject.org/",
- download_url="https://pypi.python.org/pypi/SQLObject/%s" % version,
+ download_url="https://pypi.python.org/pypi/SQLObject/%sdev-r4758" % version,
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin", "scripts/sqlobject-convertOldURI"],
Modified: SQLObject/tags/1.7.0b1/sqlobject/__version__.py
==============================================================================
--- SQLObject/tags/1.7.0b1/sqlobject/__version__.py Tue Jul 1 11:29:21 2014 (r4757)
+++ SQLObject/tags/1.7.0b1/sqlobject/__version__.py Tue Jul 1 11:33:55 2014 (r4758)
@@ -1,8 +1,8 @@
-version = '1.7'
+version = '1.7.0b1'
major = 1
minor = 7
micro = 0
-release_level = 'branch'
-serial = 0
+release_level = 'beta'
+serial = 1
version_info = (major, minor, micro, release_level, serial)
|
|
From: <sub...@co...> - 2014-07-01 17:29:30
|
Author: phd
Date: Tue Jul 1 11:29:21 2014
New Revision: 4757
Log:
Tagging 1.7.0b1
Added:
SQLObject/tags/1.7.0b1/
- copied from r4756, SQLObject/branches/1.7/
|
|
From: <sub...@co...> - 2014-06-29 14:26:37
|
Author: phd
Date: Sun Jun 29 08:26:29 2014
New Revision: 4756
Log:
Merge revision 4755 from branch 1.7: "upgrade" ez_setup to 5.3
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/ez_setup.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Sun Jun 29 08:25:25 2014 (r4755)
+++ SQLObject/trunk/docs/News.txt Sun Jun 29 08:26:29 2014 (r4756)
@@ -34,7 +34,7 @@
Minor features
--------------
-* Upgrade ez_setup to 5.2.
+* Upgrade ez_setup to 5.3.
Bugfixes
--------
Modified: SQLObject/trunk/ez_setup.py
==============================================================================
--- SQLObject/trunk/ez_setup.py Sun Jun 29 08:25:25 2014 (r4755)
+++ SQLObject/trunk/ez_setup.py Sun Jun 29 08:26:29 2014 (r4756)
@@ -36,7 +36,7 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "5.2"
+DEFAULT_VERSION = "5.3"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
|
|
From: <sub...@co...> - 2014-06-29 14:25:34
|
Author: phd
Date: Sun Jun 29 08:25:25 2014
New Revision: 4755
Log:
"Upgrade" ez_setup to 5.3
Modified:
SQLObject/branches/1.7/docs/News.txt
SQLObject/branches/1.7/ez_setup.py
Modified: SQLObject/branches/1.7/docs/News.txt
==============================================================================
--- SQLObject/branches/1.7/docs/News.txt Thu Jun 26 07:56:30 2014 (r4754)
+++ SQLObject/branches/1.7/docs/News.txt Sun Jun 29 08:25:25 2014 (r4755)
@@ -22,7 +22,7 @@
Minor features
--------------
-* Upgrade ez_setup to 5.2.
+* Upgrade ez_setup to 5.3.
Bugfixes
--------
Modified: SQLObject/branches/1.7/ez_setup.py
==============================================================================
--- SQLObject/branches/1.7/ez_setup.py Thu Jun 26 07:56:30 2014 (r4754)
+++ SQLObject/branches/1.7/ez_setup.py Sun Jun 29 08:25:25 2014 (r4755)
@@ -36,7 +36,7 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "5.2"
+DEFAULT_VERSION = "5.3"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
|
|
From: <sub...@co...> - 2014-06-26 13:56:42
|
Author: phd
Date: Thu Jun 26 07:56:30 2014
New Revision: 4754
Log:
Merge revision 4753 from branch 1.7: "upgrade" ez_setup to 5.2
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/ez_setup.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Thu Jun 26 07:55:28 2014 (r4753)
+++ SQLObject/trunk/docs/News.txt Thu Jun 26 07:56:30 2014 (r4754)
@@ -34,7 +34,7 @@
Minor features
--------------
-* Upgrade ez_setup to 5.0.
+* Upgrade ez_setup to 5.2.
Bugfixes
--------
Modified: SQLObject/trunk/ez_setup.py
==============================================================================
--- SQLObject/trunk/ez_setup.py Thu Jun 26 07:55:28 2014 (r4753)
+++ SQLObject/trunk/ez_setup.py Thu Jun 26 07:56:30 2014 (r4754)
@@ -36,7 +36,7 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "5.0"
+DEFAULT_VERSION = "5.2"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
|
|
From: <sub...@co...> - 2014-06-26 13:55:39
|
Author: phd
Date: Thu Jun 26 07:55:28 2014
New Revision: 4753
Log:
"Upgrade" ez_setup to 5.2
Modified:
SQLObject/branches/1.7/docs/News.txt
SQLObject/branches/1.7/ez_setup.py
Modified: SQLObject/branches/1.7/docs/News.txt
==============================================================================
--- SQLObject/branches/1.7/docs/News.txt Sat Jun 14 12:00:30 2014 (r4752)
+++ SQLObject/branches/1.7/docs/News.txt Thu Jun 26 07:55:28 2014 (r4753)
@@ -22,7 +22,7 @@
Minor features
--------------
-* Upgrade ez_setup to 5.0.
+* Upgrade ez_setup to 5.2.
Bugfixes
--------
Modified: SQLObject/branches/1.7/ez_setup.py
==============================================================================
--- SQLObject/branches/1.7/ez_setup.py Sat Jun 14 12:00:30 2014 (r4752)
+++ SQLObject/branches/1.7/ez_setup.py Thu Jun 26 07:55:28 2014 (r4753)
@@ -36,7 +36,7 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "5.0"
+DEFAULT_VERSION = "5.2"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
|
|
From: <sub...@co...> - 2014-06-14 18:00:36
|
Author: phd
Date: Sat Jun 14 12:00:30 2014
New Revision: 4752
Log:
Merge revision 4751 from branch 1.7: upgrade ez_setup to 5.0
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/ez_setup.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Sat Jun 14 11:59:08 2014 (r4751)
+++ SQLObject/trunk/docs/News.txt Sat Jun 14 12:00:30 2014 (r4752)
@@ -34,7 +34,7 @@
Minor features
--------------
-* Upgrade ez_setup to 3.6.0.
+* Upgrade ez_setup to 5.0.
Bugfixes
--------
Modified: SQLObject/trunk/ez_setup.py
==============================================================================
--- SQLObject/trunk/ez_setup.py Sat Jun 14 11:59:08 2014 (r4751)
+++ SQLObject/trunk/ez_setup.py Sat Jun 14 12:00:30 2014 (r4752)
@@ -27,11 +27,16 @@
from distutils import log
try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+try:
from site import USER_SITE
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "3.6"
+DEFAULT_VERSION = "5.0"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
@@ -64,17 +69,24 @@
raise IOError('Could not build the egg.')
-def get_zip_class():
+class ContextualZipFile(zipfile.ZipFile):
"""
Supplement ZipFile class to support context manager for Python 2.6
"""
- class ContextualZipFile(zipfile.ZipFile):
- def __enter__(self):
- return self
- def __exit__(self, type, value, traceback):
- self.close
- return zipfile.ZipFile if hasattr(zipfile.ZipFile, '__exit__') else \
- ContextualZipFile
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.close()
+
+ def __new__(cls, *args, **kwargs):
+ """
+ Construct a ZipFile or ContextualZipFile as appropriate
+ """
+ if hasattr(zipfile.ZipFile, '__exit__'):
+ return zipfile.ZipFile(*args, **kwargs)
+ return super(ContextualZipFile, cls).__new__(cls)
@contextlib.contextmanager
@@ -85,7 +97,7 @@
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
- with get_zip_class()(filename) as archive:
+ with ContextualZipFile(filename) as archive:
archive.extractall()
# going in the directory
@@ -183,14 +195,11 @@
if platform.system() != 'Windows':
return False
cmd = ['powershell', '-Command', 'echo test']
- devnull = open(os.path.devnull, 'wb')
- try:
+ with open(os.path.devnull, 'wb') as devnull:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except Exception:
return False
- finally:
- devnull.close()
return True
download_file_powershell.viable = has_powershell
@@ -201,14 +210,11 @@
def has_curl():
cmd = ['curl', '--version']
- devnull = open(os.path.devnull, 'wb')
- try:
+ with open(os.path.devnull, 'wb') as devnull:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except Exception:
return False
- finally:
- devnull.close()
return True
download_file_curl.viable = has_curl
@@ -219,14 +225,11 @@
def has_wget():
cmd = ['wget', '--version']
- devnull = open(os.path.devnull, 'wb')
- try:
+ with open(os.path.devnull, 'wb') as devnull:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except Exception:
return False
- finally:
- devnull.close()
return True
download_file_wget.viable = has_wget
@@ -236,37 +239,28 @@
Use Python to download the file, even though it cannot authenticate the
connection.
"""
+ src = urlopen(url)
try:
- from urllib.request import urlopen
- except ImportError:
- from urllib2 import urlopen
- src = dst = None
- try:
- src = urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
+ # Read all the data in one block.
data = src.read()
- dst = open(target, "wb")
- dst.write(data)
finally:
- if src:
- src.close()
- if dst:
- dst.close()
+ src.close()
+
+ # Write all the data in one block to avoid creating a partial file.
+ with open(target, "wb") as dst:
+ dst.write(data)
download_file_insecure.viable = lambda: True
def get_best_downloader():
- downloaders = [
+ downloaders = (
download_file_powershell,
download_file_curl,
download_file_wget,
download_file_insecure,
- ]
-
- for dl in downloaders:
- if dl.viable():
- return dl
+ )
+ viable_downloaders = (dl for dl in downloaders if dl.viable())
+ return next(viable_downloaders, None)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader):
|
|
From: <sub...@co...> - 2014-06-14 17:59:17
|
Author: phd
Date: Sat Jun 14 11:59:08 2014
New Revision: 4751
Log:
Upgrade ez_setup to 5.0
Modified:
SQLObject/branches/1.7/docs/News.txt
SQLObject/branches/1.7/ez_setup.py
Modified: SQLObject/branches/1.7/docs/News.txt
==============================================================================
--- SQLObject/branches/1.7/docs/News.txt Sun Jun 1 13:00:21 2014 (r4750)
+++ SQLObject/branches/1.7/docs/News.txt Sat Jun 14 11:59:08 2014 (r4751)
@@ -22,7 +22,7 @@
Minor features
--------------
-* Upgrade ez_setup to 3.6.0.
+* Upgrade ez_setup to 5.0.
Bugfixes
--------
Modified: SQLObject/branches/1.7/ez_setup.py
==============================================================================
--- SQLObject/branches/1.7/ez_setup.py Sun Jun 1 13:00:21 2014 (r4750)
+++ SQLObject/branches/1.7/ez_setup.py Sat Jun 14 11:59:08 2014 (r4751)
@@ -27,11 +27,16 @@
from distutils import log
try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+try:
from site import USER_SITE
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "3.6"
+DEFAULT_VERSION = "5.0"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
@@ -64,17 +69,24 @@
raise IOError('Could not build the egg.')
-def get_zip_class():
+class ContextualZipFile(zipfile.ZipFile):
"""
Supplement ZipFile class to support context manager for Python 2.6
"""
- class ContextualZipFile(zipfile.ZipFile):
- def __enter__(self):
- return self
- def __exit__(self, type, value, traceback):
- self.close
- return zipfile.ZipFile if hasattr(zipfile.ZipFile, '__exit__') else \
- ContextualZipFile
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.close()
+
+ def __new__(cls, *args, **kwargs):
+ """
+ Construct a ZipFile or ContextualZipFile as appropriate
+ """
+ if hasattr(zipfile.ZipFile, '__exit__'):
+ return zipfile.ZipFile(*args, **kwargs)
+ return super(ContextualZipFile, cls).__new__(cls)
@contextlib.contextmanager
@@ -85,7 +97,7 @@
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
- with get_zip_class()(filename) as archive:
+ with ContextualZipFile(filename) as archive:
archive.extractall()
# going in the directory
@@ -183,14 +195,11 @@
if platform.system() != 'Windows':
return False
cmd = ['powershell', '-Command', 'echo test']
- devnull = open(os.path.devnull, 'wb')
- try:
+ with open(os.path.devnull, 'wb') as devnull:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except Exception:
return False
- finally:
- devnull.close()
return True
download_file_powershell.viable = has_powershell
@@ -201,14 +210,11 @@
def has_curl():
cmd = ['curl', '--version']
- devnull = open(os.path.devnull, 'wb')
- try:
+ with open(os.path.devnull, 'wb') as devnull:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except Exception:
return False
- finally:
- devnull.close()
return True
download_file_curl.viable = has_curl
@@ -219,14 +225,11 @@
def has_wget():
cmd = ['wget', '--version']
- devnull = open(os.path.devnull, 'wb')
- try:
+ with open(os.path.devnull, 'wb') as devnull:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
except Exception:
return False
- finally:
- devnull.close()
return True
download_file_wget.viable = has_wget
@@ -236,37 +239,28 @@
Use Python to download the file, even though it cannot authenticate the
connection.
"""
+ src = urlopen(url)
try:
- from urllib.request import urlopen
- except ImportError:
- from urllib2 import urlopen
- src = dst = None
- try:
- src = urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
+ # Read all the data in one block.
data = src.read()
- dst = open(target, "wb")
- dst.write(data)
finally:
- if src:
- src.close()
- if dst:
- dst.close()
+ src.close()
+
+ # Write all the data in one block to avoid creating a partial file.
+ with open(target, "wb") as dst:
+ dst.write(data)
download_file_insecure.viable = lambda: True
def get_best_downloader():
- downloaders = [
+ downloaders = (
download_file_powershell,
download_file_curl,
download_file_wget,
download_file_insecure,
- ]
-
- for dl in downloaders:
- if dl.viable():
- return dl
+ )
+ viable_downloaders = (dl for dl in downloaders if dl.viable())
+ return next(viable_downloaders, None)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader):
|
|
From: <sub...@co...> - 2014-06-01 19:00:29
|
Author: phd
Date: Sun Jun 1 13:00:21 2014
New Revision: 4750
Log:
Merge revision 4749 from branch 1.7: upgrade ez_setup to 3.6.0
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/docs/TODO.txt
SQLObject/trunk/ez_setup.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Sun Jun 1 12:58:42 2014 (r4749)
+++ SQLObject/trunk/docs/News.txt Sun Jun 1 13:00:21 2014 (r4750)
@@ -31,6 +31,11 @@
* DateTimeCol and TimeCol can read values with microseconds (created by
SQLObject 2.0) but do not write microseconds back.
+Minor features
+--------------
+
+* Upgrade ez_setup to 3.6.0.
+
Bugfixes
--------
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Sun Jun 1 12:58:42 2014 (r4749)
+++ SQLObject/trunk/docs/TODO.txt Sun Jun 1 13:00:21 2014 (r4750)
@@ -46,8 +46,7 @@
* Cache columns in sqlmeta.getColumns(); reset the cache on add/del Column/Join.
* Stop supporting Python 2.5:
- make ConnectionHub a context manager instead of .doInTransaction();
- Upgrade ez_setup to 2.0+.
+ make ConnectionHub a context manager instead of .doInTransaction().
* Create JSONCol.
Modified: SQLObject/trunk/ez_setup.py
==============================================================================
--- SQLObject/trunk/ez_setup.py Sun Jun 1 12:58:42 2014 (r4749)
+++ SQLObject/trunk/ez_setup.py Sun Jun 1 13:00:21 2014 (r4750)
@@ -1,14 +1,14 @@
-#!python
+#!/usr/bin/env python
"""Bootstrap setuptools installation
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
+To use setuptools in your package's setup.py, include this
+file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
+To require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, simply supply
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
@@ -17,10 +17,12 @@
import shutil
import sys
import tempfile
-import tarfile
+import zipfile
import optparse
import subprocess
import platform
+import textwrap
+import contextlib
from distutils import log
@@ -29,38 +31,19 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "1.4.2"
+DEFAULT_VERSION = "3.6"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
+ """
+ Return True if the command succeeded.
+ """
args = (sys.executable,) + args
return subprocess.call(args) == 0
-def _check_call_py24(cmd, *args, **kwargs):
- res = subprocess.call(cmd, *args, **kwargs)
- class CalledProcessError(Exception):
- pass
- if not res == 0:
- msg = "Command '%s' return non-zero exit status %d" % (cmd, res)
- raise CalledProcessError(msg)
-vars(subprocess).setdefault('check_call', _check_call_py24)
-
-def _install(tarball, install_args=()):
- # extracting the tarball
- tmpdir = tempfile.mkdtemp()
- log.warn('Extracting in %s', tmpdir)
- old_wd = os.getcwd()
- try:
- os.chdir(tmpdir)
- tar = tarfile.open(tarball)
- _extractall(tar)
- tar.close()
-
- # going in the directory
- subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
- os.chdir(subdir)
- log.warn('Now working in %s', subdir)
+def _install(archive_filename, install_args=()):
+ with archive_context(archive_filename):
# installing
log.warn('Installing Setuptools')
if not _python_cmd('setup.py', 'install', *install_args):
@@ -68,47 +51,61 @@
log.warn('See the error message above.')
# exitcode will be 2
return 2
- finally:
- os.chdir(old_wd)
- shutil.rmtree(tmpdir)
-def _build_egg(egg, tarball, to_dir):
- # extracting the tarball
+def _build_egg(egg, archive_filename, to_dir):
+ with archive_context(archive_filename):
+ # building an egg
+ log.warn('Building a Setuptools egg in %s', to_dir)
+ _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
+ # returning the result
+ log.warn(egg)
+ if not os.path.exists(egg):
+ raise IOError('Could not build the egg.')
+
+
+def get_zip_class():
+ """
+ Supplement ZipFile class to support context manager for Python 2.6
+ """
+ class ContextualZipFile(zipfile.ZipFile):
+ def __enter__(self):
+ return self
+ def __exit__(self, type, value, traceback):
+ self.close
+ return zipfile.ZipFile if hasattr(zipfile.ZipFile, '__exit__') else \
+ ContextualZipFile
+
+
+@contextlib.contextmanager
+def archive_context(filename):
+ # extracting the archive
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
- tar = tarfile.open(tarball)
- _extractall(tar)
- tar.close()
+ with get_zip_class()(filename) as archive:
+ archive.extractall()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
-
- # building an egg
- log.warn('Building a Setuptools egg in %s', to_dir)
- _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
+ yield
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
- # returning the result
- log.warn(egg)
- if not os.path.exists(egg):
- raise IOError('Could not build the egg.')
def _do_download(version, download_base, to_dir, download_delay):
egg = os.path.join(to_dir, 'setuptools-%s-py%d.%d.egg'
% (version, sys.version_info[0], sys.version_info[1]))
if not os.path.exists(egg):
- tarball = download_setuptools(version, download_base,
+ archive = download_setuptools(version, download_base,
to_dir, download_delay)
- _build_egg(egg, tarball, to_dir)
+ _build_egg(egg, archive, to_dir)
sys.path.insert(0, egg)
# Remove previously-imported pkg_resources if present (see
@@ -121,11 +118,10 @@
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
- to_dir=os.curdir, download_delay=15):
- # making sure we use the absolute path
+ to_dir=os.curdir, download_delay=15):
to_dir = os.path.abspath(to_dir)
- was_imported = 'pkg_resources' in sys.modules or \
- 'setuptools' in sys.modules
+ rep_modules = 'pkg_resources', 'setuptools'
+ imported = set(sys.modules).intersection(rep_modules)
try:
import pkg_resources
except ImportError:
@@ -133,23 +129,24 @@
try:
pkg_resources.require("setuptools>=" + version)
return
- except pkg_resources.VersionConflict:
- e = sys.exc_info()[1]
- if was_imported:
- sys.stderr.write(
- "The required version of setuptools (>=%s) is not available,\n"
- "and can't be installed while this script is running. Please\n"
- "install a more recent version first, using\n"
- "'easy_install -U setuptools'."
- "\n\n(Currently using %r)\n" % (version, e.args[0]))
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
- return _do_download(version, download_base, to_dir,
- download_delay)
except pkg_resources.DistributionNotFound:
- return _do_download(version, download_base, to_dir,
- download_delay)
+ return _do_download(version, download_base, to_dir, download_delay)
+ except pkg_resources.VersionConflict as VC_err:
+ if imported:
+ msg = textwrap.dedent("""
+ The required version of setuptools (>={version}) is not available,
+ and can't be installed while this script is running. Please
+ install a more recent version first, using
+ 'easy_install -U setuptools'.
+
+ (Currently using {VC_err.args[0]!r})
+ """).format(VC_err=VC_err, version=version)
+ sys.stderr.write(msg)
+ sys.exit(2)
+
+ # otherwise, reload ok
+ del pkg_resources, sys.modules['pkg_resources']
+ return _do_download(version, download_base, to_dir, download_delay)
def _clean_check(cmd, target):
"""
@@ -169,10 +166,16 @@
trust). Raise an exception if the command cannot complete.
"""
target = os.path.abspath(target)
+ ps_cmd = (
+ "[System.Net.WebRequest]::DefaultWebProxy.Credentials = "
+ "[System.Net.CredentialCache]::DefaultCredentials; "
+ "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)"
+ % vars()
+ )
cmd = [
'powershell',
'-Command',
- "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)" % vars(),
+ ps_cmd,
]
_clean_check(cmd, target)
@@ -184,7 +187,7 @@
try:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
+ except Exception:
return False
finally:
devnull.close()
@@ -202,7 +205,7 @@
try:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
+ except Exception:
return False
finally:
devnull.close()
@@ -220,7 +223,7 @@
try:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
+ except Exception:
return False
finally:
devnull.close()
@@ -266,9 +269,9 @@
return dl
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
- to_dir=os.curdir, delay=15,
- downloader_factory=get_best_downloader):
- """Download setuptools from a specified location and return its filename
+ to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader):
+ """
+ Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end
@@ -281,74 +284,20 @@
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
- tgz_name = "setuptools-%s.tar.gz" % version
- url = download_base + tgz_name
- saveto = os.path.join(to_dir, tgz_name)
+ zip_name = "setuptools-%s.zip" % version
+ url = download_base + zip_name
+ saveto = os.path.join(to_dir, zip_name)
if not os.path.exists(saveto): # Avoid repeated downloads
log.warn("Downloading %s", url)
downloader = downloader_factory()
downloader(url, saveto)
return os.path.realpath(saveto)
-
-def _extractall(self, path=".", members=None):
- """Extract all members from the archive to the current working
- directory and set owner, modification time and permissions on
- directories afterwards. `path' specifies a different directory
- to extract to. `members' is optional and must be a subset of the
- list returned by getmembers().
- """
- import copy
- import operator
- from tarfile import ExtractError
- directories = []
-
- if members is None:
- members = self
-
- for tarinfo in members:
- if tarinfo.isdir():
- # Extract directories with a safe mode.
- directories.append(tarinfo)
- tarinfo = copy.copy(tarinfo)
- tarinfo.mode = 448 # decimal for oct 0700
- self.extract(tarinfo, path)
-
- # Reverse sort directories.
- if sys.version_info < (2, 4):
- def sorter(dir1, dir2):
- return cmp(dir1.name, dir2.name)
- directories.sort(sorter)
- directories.reverse()
- else:
- directories.sort(key=operator.attrgetter('name'), reverse=True)
-
- # Set correct owner, mtime and filemode on directories.
- for tarinfo in directories:
- dirpath = os.path.join(path, tarinfo.name)
- try:
- self.chown(tarinfo, dirpath)
- self.utime(tarinfo, dirpath)
- self.chmod(tarinfo, dirpath)
- except ExtractError:
- e = sys.exc_info()[1]
- if self.errorlevel > 1:
- raise
- else:
- self._dbg(1, "tarfile: %s" % e)
-
-
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the setuptools package
"""
- install_args = []
- if options.user_install:
- if sys.version_info < (2, 6):
- log.warn("--user requires Python 2.6 or later")
- raise SystemExit(1)
- install_args.append('--user')
- return install_args
+ return ['--user'] if options.user_install else []
def _parse_args():
"""
@@ -367,16 +316,23 @@
const=lambda: download_file_insecure, default=get_best_downloader,
help='Use internal, non-validating downloader'
)
+ parser.add_option(
+ '--version', help="Specify which version to download",
+ default=DEFAULT_VERSION,
+ )
options, args = parser.parse_args()
# positional arguments are ignored
return options
-def main(version=DEFAULT_VERSION):
+def main():
"""Install or upgrade setuptools and EasyInstall"""
options = _parse_args()
- tarball = download_setuptools(download_base=options.download_base,
- downloader_factory=options.downloader_factory)
- return _install(tarball, _build_install_args(options))
+ archive = download_setuptools(
+ version=options.version,
+ download_base=options.download_base,
+ downloader_factory=options.downloader_factory,
+ )
+ return _install(archive, _build_install_args(options))
if __name__ == '__main__':
sys.exit(main())
|
|
From: <sub...@co...> - 2014-06-01 18:58:51
|
Author: phd
Date: Sun Jun 1 12:58:42 2014
New Revision: 4749
Log:
Upgrade ez_setup to 3.6.0
Modified:
SQLObject/branches/1.7/docs/News.txt
SQLObject/branches/1.7/docs/TODO.txt
SQLObject/branches/1.7/ez_setup.py
Modified: SQLObject/branches/1.7/docs/News.txt
==============================================================================
--- SQLObject/branches/1.7/docs/News.txt Thu May 15 09:17:27 2014 (r4748)
+++ SQLObject/branches/1.7/docs/News.txt Sun Jun 1 12:58:42 2014 (r4749)
@@ -19,6 +19,11 @@
* DateTimeCol and TimeCol can read values with microseconds (created by
SQLObject 2.0) but do not write microseconds back.
+Minor features
+--------------
+
+* Upgrade ez_setup to 3.6.0.
+
Bugfixes
--------
Modified: SQLObject/branches/1.7/docs/TODO.txt
==============================================================================
--- SQLObject/branches/1.7/docs/TODO.txt Thu May 15 09:17:27 2014 (r4748)
+++ SQLObject/branches/1.7/docs/TODO.txt Sun Jun 1 12:58:42 2014 (r4749)
@@ -46,8 +46,7 @@
* Cache columns in sqlmeta.getColumns(); reset the cache on add/del Column/Join.
* Stop supporting Python 2.5:
- make ConnectionHub a context manager instead of .doInTransaction();
- Upgrade ez_setup to 2.0+.
+ make ConnectionHub a context manager instead of .doInTransaction().
* Create JSONCol.
Modified: SQLObject/branches/1.7/ez_setup.py
==============================================================================
--- SQLObject/branches/1.7/ez_setup.py Thu May 15 09:17:27 2014 (r4748)
+++ SQLObject/branches/1.7/ez_setup.py Sun Jun 1 12:58:42 2014 (r4749)
@@ -1,14 +1,14 @@
-#!python
+#!/usr/bin/env python
"""Bootstrap setuptools installation
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
+To use setuptools in your package's setup.py, include this
+file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
+To require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, simply supply
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
@@ -17,10 +17,12 @@
import shutil
import sys
import tempfile
-import tarfile
+import zipfile
import optparse
import subprocess
import platform
+import textwrap
+import contextlib
from distutils import log
@@ -29,38 +31,19 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "1.4.2"
+DEFAULT_VERSION = "3.6"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
+ """
+ Return True if the command succeeded.
+ """
args = (sys.executable,) + args
return subprocess.call(args) == 0
-def _check_call_py24(cmd, *args, **kwargs):
- res = subprocess.call(cmd, *args, **kwargs)
- class CalledProcessError(Exception):
- pass
- if not res == 0:
- msg = "Command '%s' return non-zero exit status %d" % (cmd, res)
- raise CalledProcessError(msg)
-vars(subprocess).setdefault('check_call', _check_call_py24)
-
-def _install(tarball, install_args=()):
- # extracting the tarball
- tmpdir = tempfile.mkdtemp()
- log.warn('Extracting in %s', tmpdir)
- old_wd = os.getcwd()
- try:
- os.chdir(tmpdir)
- tar = tarfile.open(tarball)
- _extractall(tar)
- tar.close()
-
- # going in the directory
- subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
- os.chdir(subdir)
- log.warn('Now working in %s', subdir)
+def _install(archive_filename, install_args=()):
+ with archive_context(archive_filename):
# installing
log.warn('Installing Setuptools')
if not _python_cmd('setup.py', 'install', *install_args):
@@ -68,47 +51,61 @@
log.warn('See the error message above.')
# exitcode will be 2
return 2
- finally:
- os.chdir(old_wd)
- shutil.rmtree(tmpdir)
-def _build_egg(egg, tarball, to_dir):
- # extracting the tarball
+def _build_egg(egg, archive_filename, to_dir):
+ with archive_context(archive_filename):
+ # building an egg
+ log.warn('Building a Setuptools egg in %s', to_dir)
+ _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
+ # returning the result
+ log.warn(egg)
+ if not os.path.exists(egg):
+ raise IOError('Could not build the egg.')
+
+
+def get_zip_class():
+ """
+ Supplement ZipFile class to support context manager for Python 2.6
+ """
+ class ContextualZipFile(zipfile.ZipFile):
+ def __enter__(self):
+ return self
+ def __exit__(self, type, value, traceback):
+ self.close
+ return zipfile.ZipFile if hasattr(zipfile.ZipFile, '__exit__') else \
+ ContextualZipFile
+
+
+@contextlib.contextmanager
+def archive_context(filename):
+ # extracting the archive
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
- tar = tarfile.open(tarball)
- _extractall(tar)
- tar.close()
+ with get_zip_class()(filename) as archive:
+ archive.extractall()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
-
- # building an egg
- log.warn('Building a Setuptools egg in %s', to_dir)
- _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
+ yield
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
- # returning the result
- log.warn(egg)
- if not os.path.exists(egg):
- raise IOError('Could not build the egg.')
def _do_download(version, download_base, to_dir, download_delay):
egg = os.path.join(to_dir, 'setuptools-%s-py%d.%d.egg'
% (version, sys.version_info[0], sys.version_info[1]))
if not os.path.exists(egg):
- tarball = download_setuptools(version, download_base,
+ archive = download_setuptools(version, download_base,
to_dir, download_delay)
- _build_egg(egg, tarball, to_dir)
+ _build_egg(egg, archive, to_dir)
sys.path.insert(0, egg)
# Remove previously-imported pkg_resources if present (see
@@ -121,11 +118,10 @@
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
- to_dir=os.curdir, download_delay=15):
- # making sure we use the absolute path
+ to_dir=os.curdir, download_delay=15):
to_dir = os.path.abspath(to_dir)
- was_imported = 'pkg_resources' in sys.modules or \
- 'setuptools' in sys.modules
+ rep_modules = 'pkg_resources', 'setuptools'
+ imported = set(sys.modules).intersection(rep_modules)
try:
import pkg_resources
except ImportError:
@@ -133,23 +129,24 @@
try:
pkg_resources.require("setuptools>=" + version)
return
- except pkg_resources.VersionConflict:
- e = sys.exc_info()[1]
- if was_imported:
- sys.stderr.write(
- "The required version of setuptools (>=%s) is not available,\n"
- "and can't be installed while this script is running. Please\n"
- "install a more recent version first, using\n"
- "'easy_install -U setuptools'."
- "\n\n(Currently using %r)\n" % (version, e.args[0]))
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
- return _do_download(version, download_base, to_dir,
- download_delay)
except pkg_resources.DistributionNotFound:
- return _do_download(version, download_base, to_dir,
- download_delay)
+ return _do_download(version, download_base, to_dir, download_delay)
+ except pkg_resources.VersionConflict as VC_err:
+ if imported:
+ msg = textwrap.dedent("""
+ The required version of setuptools (>={version}) is not available,
+ and can't be installed while this script is running. Please
+ install a more recent version first, using
+ 'easy_install -U setuptools'.
+
+ (Currently using {VC_err.args[0]!r})
+ """).format(VC_err=VC_err, version=version)
+ sys.stderr.write(msg)
+ sys.exit(2)
+
+ # otherwise, reload ok
+ del pkg_resources, sys.modules['pkg_resources']
+ return _do_download(version, download_base, to_dir, download_delay)
def _clean_check(cmd, target):
"""
@@ -169,10 +166,16 @@
trust). Raise an exception if the command cannot complete.
"""
target = os.path.abspath(target)
+ ps_cmd = (
+ "[System.Net.WebRequest]::DefaultWebProxy.Credentials = "
+ "[System.Net.CredentialCache]::DefaultCredentials; "
+ "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)"
+ % vars()
+ )
cmd = [
'powershell',
'-Command',
- "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)" % vars(),
+ ps_cmd,
]
_clean_check(cmd, target)
@@ -184,7 +187,7 @@
try:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
+ except Exception:
return False
finally:
devnull.close()
@@ -202,7 +205,7 @@
try:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
+ except Exception:
return False
finally:
devnull.close()
@@ -220,7 +223,7 @@
try:
try:
subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
+ except Exception:
return False
finally:
devnull.close()
@@ -266,9 +269,9 @@
return dl
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
- to_dir=os.curdir, delay=15,
- downloader_factory=get_best_downloader):
- """Download setuptools from a specified location and return its filename
+ to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader):
+ """
+ Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end
@@ -281,74 +284,20 @@
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
- tgz_name = "setuptools-%s.tar.gz" % version
- url = download_base + tgz_name
- saveto = os.path.join(to_dir, tgz_name)
+ zip_name = "setuptools-%s.zip" % version
+ url = download_base + zip_name
+ saveto = os.path.join(to_dir, zip_name)
if not os.path.exists(saveto): # Avoid repeated downloads
log.warn("Downloading %s", url)
downloader = downloader_factory()
downloader(url, saveto)
return os.path.realpath(saveto)
-
-def _extractall(self, path=".", members=None):
- """Extract all members from the archive to the current working
- directory and set owner, modification time and permissions on
- directories afterwards. `path' specifies a different directory
- to extract to. `members' is optional and must be a subset of the
- list returned by getmembers().
- """
- import copy
- import operator
- from tarfile import ExtractError
- directories = []
-
- if members is None:
- members = self
-
- for tarinfo in members:
- if tarinfo.isdir():
- # Extract directories with a safe mode.
- directories.append(tarinfo)
- tarinfo = copy.copy(tarinfo)
- tarinfo.mode = 448 # decimal for oct 0700
- self.extract(tarinfo, path)
-
- # Reverse sort directories.
- if sys.version_info < (2, 4):
- def sorter(dir1, dir2):
- return cmp(dir1.name, dir2.name)
- directories.sort(sorter)
- directories.reverse()
- else:
- directories.sort(key=operator.attrgetter('name'), reverse=True)
-
- # Set correct owner, mtime and filemode on directories.
- for tarinfo in directories:
- dirpath = os.path.join(path, tarinfo.name)
- try:
- self.chown(tarinfo, dirpath)
- self.utime(tarinfo, dirpath)
- self.chmod(tarinfo, dirpath)
- except ExtractError:
- e = sys.exc_info()[1]
- if self.errorlevel > 1:
- raise
- else:
- self._dbg(1, "tarfile: %s" % e)
-
-
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the setuptools package
"""
- install_args = []
- if options.user_install:
- if sys.version_info < (2, 6):
- log.warn("--user requires Python 2.6 or later")
- raise SystemExit(1)
- install_args.append('--user')
- return install_args
+ return ['--user'] if options.user_install else []
def _parse_args():
"""
@@ -367,16 +316,23 @@
const=lambda: download_file_insecure, default=get_best_downloader,
help='Use internal, non-validating downloader'
)
+ parser.add_option(
+ '--version', help="Specify which version to download",
+ default=DEFAULT_VERSION,
+ )
options, args = parser.parse_args()
# positional arguments are ignored
return options
-def main(version=DEFAULT_VERSION):
+def main():
"""Install or upgrade setuptools and EasyInstall"""
options = _parse_args()
- tarball = download_setuptools(download_base=options.download_base,
- downloader_factory=options.downloader_factory)
- return _install(tarball, _build_install_args(options))
+ archive = download_setuptools(
+ version=options.version,
+ download_base=options.download_base,
+ downloader_factory=options.downloader_factory,
+ )
+ return _install(archive, _build_install_args(options))
if __name__ == '__main__':
sys.exit(main())
|
|
From: <sub...@co...> - 2014-05-15 15:17:34
|
Author: phd Date: Thu May 15 09:17:27 2014 New Revision: 4748 Log: Version 1.6.0 final Modified: SQLObject/tags/1.6.0/README.txt SQLObject/tags/1.6.0/setup.cfg SQLObject/tags/1.6.0/sqlobject/__version__.py Modified: SQLObject/tags/1.6.0/README.txt ============================================================================== --- SQLObject/tags/1.6.0/README.txt Thu May 15 09:14:43 2014 (r4747) +++ SQLObject/tags/1.6.0/README.txt Thu May 15 09:17:27 2014 (r4748) @@ -1,5 +1,5 @@ -SQLObject 1.6 -============= +SQLObject 1.6.0 +=============== Thanks for looking at SQLObject. SQLObject is an object-relational mapper, i.e., a library that will wrap your database tables in Python Modified: SQLObject/tags/1.6.0/setup.cfg ============================================================================== --- SQLObject/tags/1.6.0/setup.cfg Thu May 15 09:14:43 2014 (r4747) +++ SQLObject/tags/1.6.0/setup.cfg Thu May 15 09:17:27 2014 (r4748) @@ -5,10 +5,6 @@ [easy_install] #find_links = http://svn.pythonpaste.org/package_index.html -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] theme = pythonpaste.org docs = docs/index.txt docs/Authors.txt docs/DeveloperGuide.txt docs/FAQ.txt Modified: SQLObject/tags/1.6.0/sqlobject/__version__.py ============================================================================== --- SQLObject/tags/1.6.0/sqlobject/__version__.py Thu May 15 09:14:43 2014 (r4747) +++ SQLObject/tags/1.6.0/sqlobject/__version__.py Thu May 15 09:17:27 2014 (r4748) @@ -1,8 +1,8 @@ -version = '1.6' +version = '1.6.0' major = 1 minor = 6 micro = 0 -release_level = 'branch' +release_level = 'final' serial = 0 version_info = (major, minor, micro, release_level, serial) |
|
From: <sub...@co...> - 2014-05-15 15:14:50
|
Author: phd
Date: Thu May 15 09:14:43 2014
New Revision: 4747
Log:
Tagging 1.6.0
Added:
SQLObject/tags/1.6.0/
- copied from r4746, SQLObject/branches/1.6/
|
|
From: <sub...@co...> - 2014-05-15 15:12:56
|
Author: phd Date: Thu May 15 09:12:48 2014 New Revision: 4746 Log: Merge revision 4744 from branch 1.6: SQLObject 1.6.0 was released 15 May 2014 Modified: SQLObject/trunk/docs/News.txt Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Thu May 15 09:12:07 2014 (r4745) +++ SQLObject/trunk/docs/News.txt Thu May 15 09:12:48 2014 (r4746) @@ -39,6 +39,8 @@ SQLObject 1.6.0 =============== +Released 15 May 2014. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2014-05-15 15:12:14
|
Author: phd Date: Thu May 15 09:12:07 2014 New Revision: 4745 Log: Merge revision 4744 from branch 1.6: SQLObject 1.6.0 was released 15 May 2014 Modified: SQLObject/branches/1.7/docs/News.txt Modified: SQLObject/branches/1.7/docs/News.txt ============================================================================== --- SQLObject/branches/1.7/docs/News.txt Thu May 15 09:10:01 2014 (r4744) +++ SQLObject/branches/1.7/docs/News.txt Thu May 15 09:12:07 2014 (r4745) @@ -27,6 +27,8 @@ SQLObject 1.6.0 =============== +Released 15 May 2014. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2014-05-15 15:10:19
|
Author: phd Date: Thu May 15 09:10:01 2014 New Revision: 4744 Log: SQLObject 1.6.0 was released 15 May 2014 Modified: SQLObject/branches/1.6/docs/News.txt Modified: SQLObject/branches/1.6/docs/News.txt ============================================================================== --- SQLObject/branches/1.6/docs/News.txt Mon May 12 13:21:43 2014 (r4743) +++ SQLObject/branches/1.6/docs/News.txt Thu May 15 09:10:01 2014 (r4744) @@ -10,6 +10,8 @@ SQLObject 1.6.0 =============== +Released 15 May 2014. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2014-05-12 19:21:50
|
Author: phd Date: Mon May 12 13:21:43 2014 New Revision: 4743 Log: Merge revision 4741 from branch 1.6: split news into minor features and bugfixes Modified: SQLObject/trunk/docs/News.txt Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Mon May 12 13:21:21 2014 (r4742) +++ SQLObject/trunk/docs/News.txt Mon May 12 13:21:43 2014 (r4743) @@ -45,8 +45,14 @@ * Python 2.4 is no longer supported. The minimal supported version is Python 2.5. +Minor features +-------------- + * Upgrade ez_setup to 1.4.2. +Bugfixes +-------- + * A bugfix was ported from `SQLObject 1.5.2`_. SQLObject 1.5.2 |
|
From: <sub...@co...> - 2014-05-12 19:21:29
|
Author: phd Date: Mon May 12 13:21:21 2014 New Revision: 4742 Log: Merge revision 4741 from branch 1.6: split news into minor features and bugfixes Modified: SQLObject/branches/1.7/docs/News.txt Modified: SQLObject/branches/1.7/docs/News.txt ============================================================================== --- SQLObject/branches/1.7/docs/News.txt Mon May 12 13:19:44 2014 (r4741) +++ SQLObject/branches/1.7/docs/News.txt Mon May 12 13:21:21 2014 (r4742) @@ -33,8 +33,14 @@ * Python 2.4 is no longer supported. The minimal supported version is Python 2.5. +Minor features +-------------- + * Upgrade ez_setup to 1.4.2. +Bugfixes +-------- + * A bugfix was ported from `SQLObject 1.5.2`_. SQLObject 1.5.2 |
|
From: <sub...@co...> - 2014-05-12 19:19:53
|
Author: phd Date: Mon May 12 13:19:44 2014 New Revision: 4741 Log: Split news into minor features and bugfixes Modified: SQLObject/branches/1.6/docs/News.txt Modified: SQLObject/branches/1.6/docs/News.txt ============================================================================== --- SQLObject/branches/1.6/docs/News.txt Sun May 11 10:46:13 2014 (r4740) +++ SQLObject/branches/1.6/docs/News.txt Mon May 12 13:19:44 2014 (r4741) @@ -19,8 +19,14 @@ * Support for Python 2.5 is declared obsolete and will be removed in the next release. +Minor features +-------------- + * Upgrade ez_setup to 1.4.2. +Bugfixes +-------- + * A bugfix was ported from `SQLObject 1.5.2`_. SQLObject 1.5.2 |
|
From: <sub...@co...> - 2014-05-11 16:46:20
|
Author: phd
Date: Sun May 11 10:46:13 2014
New Revision: 4740
Log:
Merge revision 4739 from branch 1.7: replace time.strptime with datetime.strptime
Modified:
SQLObject/trunk/docs/TODO.txt
SQLObject/trunk/sqlobject/col.py
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Sun May 11 10:45:09 2014 (r4739)
+++ SQLObject/trunk/docs/TODO.txt Sun May 11 10:46:13 2014 (r4740)
@@ -47,7 +47,7 @@
* Stop supporting Python 2.5:
make ConnectionHub a context manager instead of .doInTransaction();
- replace time.strptime with datetime.strptime. Upgrade ez_setup to 2.0+.
+ Upgrade ez_setup to 2.0+.
* Create JSONCol.
Modified: SQLObject/trunk/sqlobject/col.py
==============================================================================
--- SQLObject/trunk/sqlobject/col.py Sun May 11 10:45:09 2014 (r4739)
+++ SQLObject/trunk/sqlobject/col.py Sun May 11 10:46:13 2014 (r4740)
@@ -1113,11 +1113,7 @@
value = '.'.join(_value)
else:
value += '.0'
- if sys.version_info[:3] < (2, 6, 0): # datetime.strptime in python2.5 doesn't support '%f' format
- stime = time.strptime(value, self.format)
- return datetime.datetime(*stime[:6])
- else:
- return datetime.datetime.strptime(value, self.format)
+ return datetime.datetime.strptime(value, self.format)
except:
raise validators.Invalid("expected a date/time string of the '%s' format in the DateTimeCol '%s', got %s %r instead" % \
(self.format, self.name, type(value), value), value, state)
@@ -1160,13 +1156,9 @@
value = '.'.join(_value)
else:
value += '.0'
- if sys.version_info[:3] < (2, 6, 0): # datetime.strptime in python2.5 doesn't support '%f' format
- stime = time.strptime(value, self.format)
- return DateTime.mktime(stime)
- else:
- value = datetime.datetime.strptime(value, self.format)
- return DateTime.DateTime(value.year, value.month, value.day,
- value.hour, value.minute, value.second)
+ value = datetime.datetime.strptime(value, self.format)
+ return DateTime.DateTime(value.year, value.month, value.day,
+ value.hour, value.minute, value.second)
except:
raise validators.Invalid("expected a date/time string of the '%s' format in the DateTimeCol '%s', got %s %r instead" % \
(self.format, self.name, type(value), value), value, state)
|
|
From: <sub...@co...> - 2014-05-11 16:45:16
|
Author: phd
Date: Sun May 11 10:45:09 2014
New Revision: 4739
Log:
Stop supporting Python 2.5: replace time.strptime with datetime.strptime
Modified:
SQLObject/branches/1.7/docs/TODO.txt
SQLObject/branches/1.7/sqlobject/col.py
Modified: SQLObject/branches/1.7/docs/TODO.txt
==============================================================================
--- SQLObject/branches/1.7/docs/TODO.txt Sun May 11 10:17:06 2014 (r4738)
+++ SQLObject/branches/1.7/docs/TODO.txt Sun May 11 10:45:09 2014 (r4739)
@@ -47,7 +47,7 @@
* Stop supporting Python 2.5:
make ConnectionHub a context manager instead of .doInTransaction();
- replace time.strptime with datetime.strptime. Upgrade ez_setup to 2.0+.
+ Upgrade ez_setup to 2.0+.
* Create JSONCol.
Modified: SQLObject/branches/1.7/sqlobject/col.py
==============================================================================
--- SQLObject/branches/1.7/sqlobject/col.py Sun May 11 10:17:06 2014 (r4738)
+++ SQLObject/branches/1.7/sqlobject/col.py Sun May 11 10:45:09 2014 (r4739)
@@ -1113,11 +1113,7 @@
value = '.'.join(_value)
else:
value += '.0'
- if sys.version_info[:3] < (2, 6, 0): # datetime.strptime in python2.5 doesn't support '%f' format
- stime = time.strptime(value, self.format)
- return datetime.datetime(*stime[:6])
- else:
- return datetime.datetime.strptime(value, self.format)
+ return datetime.datetime.strptime(value, self.format)
except:
raise validators.Invalid("expected a date/time string of the '%s' format in the DateTimeCol '%s', got %s %r instead" % \
(self.format, self.name, type(value), value), value, state)
@@ -1160,13 +1156,9 @@
value = '.'.join(_value)
else:
value += '.0'
- if sys.version_info[:3] < (2, 6, 0): # datetime.strptime in python2.5 doesn't support '%f' format
- stime = time.strptime(value, self.format)
- return DateTime.mktime(stime)
- else:
- value = datetime.datetime.strptime(value, self.format)
- return DateTime.DateTime(value.year, value.month, value.day,
- value.hour, value.minute, value.second)
+ value = datetime.datetime.strptime(value, self.format)
+ return DateTime.DateTime(value.year, value.month, value.day,
+ value.hour, value.minute, value.second)
except:
raise validators.Invalid("expected a date/time string of the '%s' format in the DateTimeCol '%s', got %s %r instead" % \
(self.format, self.name, type(value), value), value, state)
|
|
From: <sub...@co...> - 2014-05-11 16:17:13
|
Author: phd Date: Sun May 11 10:17:06 2014 New Revision: 4738 Log: Elaborate warning Document that the most painful backward compatibility problem with microseconds is with SQLite backend. Modified: SQLObject/trunk/docs/News.txt Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Sun May 11 10:05:12 2014 (r4737) +++ SQLObject/trunk/docs/News.txt Sun May 11 10:17:06 2014 (r4738) @@ -16,8 +16,8 @@ * DateTimeCol and TimeCol can read and write values with microseconds. WARNING: backward compatibility problem! Date/Time columns created - with microseconds cannot be read back with versions of SQLObject older - than 1.7. + with microseconds cannot be read back from SQLite databases (and + perhaps other backends) with versions of SQLObject older than 1.7. SQLObject 1.7.0 =============== |
|
From: <sub...@co...> - 2014-05-11 16:05:19
|
Author: phd
Date: Sun May 11 10:05:12 2014
New Revision: 4737
Log:
Backport revision 4732 from branch 1.7: document sqlhub.doInTransaction
Modified:
SQLObject/branches/1.6/docs/SQLObject.txt
Modified: SQLObject/branches/1.6/docs/SQLObject.txt
==============================================================================
--- SQLObject/branches/1.6/docs/SQLObject.txt Sun May 11 10:04:14 2014 (r4736)
+++ SQLObject/branches/1.6/docs/SQLObject.txt Sun May 11 10:05:12 2014 (r4737)
@@ -1432,6 +1432,13 @@
Person.select(Person.q.name=="value", forUpdate=True, connection=trans)
+Method ``sqlhub.doInTransaction`` can be used to run a piece of code in
+a transaction. The method accepts a callable and positional and keywords
+arguments. It begins a transaction using its ``processConnection`` or
+``threadConnection``, calls the callable, commits the transaction and
+closes the underlying connection; it returns whatever the callable
+returned. If an error occurs during call to the callable it rolls the
+transaction back and reraise the exception.
Automatic Schema Generation
---------------------------
|
|
From: <sub...@co...> - 2014-05-11 16:04:21
|
Author: phd
Date: Sun May 11 10:04:14 2014
New Revision: 4736
Log:
Backport revision 4732 from branch 1.7: document sqlhub.doInTransaction
Modified:
SQLObject/branches/1.5/docs/SQLObject.txt
Modified: SQLObject/branches/1.5/docs/SQLObject.txt
==============================================================================
--- SQLObject/branches/1.5/docs/SQLObject.txt Sun May 11 09:54:16 2014 (r4735)
+++ SQLObject/branches/1.5/docs/SQLObject.txt Sun May 11 10:04:14 2014 (r4736)
@@ -1432,6 +1432,13 @@
Person.select(Person.q.name=="value", forUpdate=True, connection=trans)
+Method ``sqlhub.doInTransaction`` can be used to run a piece of code in
+a transaction. The method accepts a callable and positional and keywords
+arguments. It begins a transaction using its ``processConnection`` or
+``threadConnection``, calls the callable, commits the transaction and
+closes the underlying connection; it returns whatever the callable
+returned. If an error occurs during call to the callable it rolls the
+transaction back and reraise the exception.
Automatic Schema Generation
---------------------------
|