Skip to content

Commit

Permalink
Merge pull request #1140 from xael-fry/1126_installModuleFix1.4.x
Browse files Browse the repository at this point in the history
[#1126] install module fix1.4.x
  • Loading branch information
xael-fry committed May 19, 2017
2 parents 2338f92 + 4ece0ca commit 181b56c
Show file tree
Hide file tree
Showing 764 changed files with 167,481 additions and 153,161 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sudo: required
dist: trusty
language: java
jdk:
- openjdk7
Expand Down
61 changes: 50 additions & 11 deletions framework/pym/play/commands/modulesrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

DEFAULT_REPO = 'https://www.playframework.com'

DEFAULT_USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'

def load_module(name):
base = os.path.normpath(os.path.dirname(os.path.realpath(sys.argv[0])))
mod_desc = imp.find_module(name, [os.path.join(base, 'framework/pym')])
Expand Down Expand Up @@ -72,7 +74,6 @@ def get_repositories(play_base):
return repos
return [DEFAULT_REPO]


class Downloader(object):
before = .0
history = []
Expand All @@ -86,8 +87,14 @@ def __init__(self, width=55):

def retrieve(self, url, destination, callback=None):
self.size = 0
time.clock()
try: urllib.urlretrieve(url, destination, self.progress)
time.clock()
try:
headers={'User-Agent':DEFAULT_USER_AGENT,
'Accept': 'application/json'
}
req = urllib2.Request(url, headers=headers)
result = urllib2.urlopen(req)
self.chunk_read(result, destination, report_hook=self.chunk_report)
except KeyboardInterrupt:
print '\n~ Download cancelled'
print '~'
Expand All @@ -103,14 +110,43 @@ def retrieve(self, url, destination, callback=None):
print ''
return self.size

def progress(self, blocks, blocksize, filesize):
def chunk_read(self, response, destination, chunk_size=8192, report_hook=None):
total_size = response.info().getheader('Content-Length').strip()
total_size = int(total_size)
bytes_so_far = 0
file = open(destination,"wb")

while 1:
chunk = response.read(chunk_size)
file.write(chunk)
bytes_so_far += len(chunk)

if not chunk:
break

if report_hook:
#report_hook(bytes_so_far, chunk_size, total_size)
self.progress(bytes_so_far, chunk_size, total_size)

return bytes_so_far


def chunk_report(self, bytes_so_far, chunk_size, total_size):
percent = float(bytes_so_far) / total_size
percent = round(percent*100, 2)
sys.stdout.write("Downloaded %d of %d bytes (%0.2f%%)\r" % (bytes_so_far, total_size, percent))
if bytes_so_far >= total_size:
sys.stdout.write('\n')


def progress(self, bytes_so_far, blocksize, filesize):
self.cycles += 1
bits = min(blocks*blocksize, filesize)
bits = min(bytes_so_far, filesize)
if bits != filesize:
done = self.proc(bits, filesize)
else:
done = 100
bar = self.bar(done)
bar = self.bar(bytes_so_far, filesize, done)
if not self.cycles % 3 and bits != filesize:
now = time.clock()
elapsed = now-self.before
Expand All @@ -123,13 +159,12 @@ def progress(self, blocks, blocksize, filesize):
self.size = self.kibi(bits)
print '\r~ [%s] %s KiB/s ' % (bar, str(average)),

def bar(self, done):
def bar(self, bytes_so_far, filesize, done):
span = self.width * done * 0.01
offset = len(str(int(done))) - .99
result = ('%d%%' % (done,)).center(self.width)
result = ('%s of %s KiB (%d%%)' % (self.kibi(bytes_so_far), self.kibi(filesize), done,)).center(self.width)
return result.replace(' ', '-', int(span - offset))


class Unzip:
def __init__(self, verbose = False, percent = 10):
self.verbose = verbose
Expand Down Expand Up @@ -431,6 +466,7 @@ def install(app, args, env):

print '~'
print '~ Fetching %s' % fetch

Downloader().retrieve(fetch, archive)

if not os.path.exists(archive):
Expand Down Expand Up @@ -527,13 +563,16 @@ def any(arr, func):
def load_modules_from(modules_server):
try:
url = '%s/modules' % modules_server
req = urllib2.Request(url)
req.add_header('Accept', 'application/json')
headers={'User-Agent':DEFAULT_USER_AGENT,
'Accept': 'application/json'
}
req = urllib2.Request(url, headers=headers)
result = urllib2.urlopen(req)
return json.loads(result.read())
except urllib2.HTTPError, e:
print "~ Oops,"
print "~ Cannot fetch the modules list from %s (%s)..." % (url, e.code)
print e.reason
print "~"
sys.exit(-1)
except urllib2.URLError, e:
Expand Down
Binary file modified python/DLLs/_bsddb.pyd
Binary file not shown.
Binary file modified python/DLLs/_ctypes.pyd
Binary file not shown.
Binary file modified python/DLLs/_ctypes_test.pyd
Binary file not shown.
Binary file modified python/DLLs/_elementtree.pyd
Binary file not shown.
Binary file modified python/DLLs/_hashlib.pyd
Binary file not shown.
Binary file modified python/DLLs/_msi.pyd
Binary file not shown.
Binary file modified python/DLLs/_multiprocessing.pyd
Binary file not shown.
Binary file modified python/DLLs/_socket.pyd
Binary file not shown.
Binary file modified python/DLLs/_ssl.pyd
Binary file not shown.
Binary file modified python/DLLs/_testcapi.pyd
Binary file not shown.
Binary file removed python/DLLs/_tkinter.pyd
Binary file not shown.
Binary file modified python/DLLs/bz2.pyd
Binary file not shown.
Binary file modified python/DLLs/pyexpat.pyd
Binary file not shown.
Binary file modified python/DLLs/select.pyd
Binary file not shown.
Binary file modified python/DLLs/unicodedata.pyd
Binary file not shown.
Binary file modified python/DLLs/winsound.pyd
Binary file not shown.
51 changes: 17 additions & 34 deletions python/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,9 @@ the various releases.
2.1 2.0+1.6.1 2001 PSF no
2.0.1 2.0+1.6.1 2001 PSF yes
2.1.1 2.1+2.0.1 2001 PSF yes
2.2 2.1.1 2001 PSF yes
2.1.2 2.1.1 2002 PSF yes
2.1.3 2.1.2 2002 PSF yes
2.2.1 2.2 2002 PSF yes
2.2.2 2.2.1 2002 PSF yes
2.2.3 2.2.2 2003 PSF yes
2.3 2.2.2 2002-2003 PSF yes
2.3.1 2.3 2002-2003 PSF yes
2.3.2 2.3.1 2002-2003 PSF yes
2.3.3 2.3.2 2002-2003 PSF yes
2.3.4 2.3.3 2004 PSF yes
2.3.5 2.3.4 2005 PSF yes
2.4 2.3 2004 PSF yes
2.4.1 2.4 2005 PSF yes
2.4.2 2.4.1 2005 PSF yes
2.4.3 2.4.2 2006 PSF yes
2.4.4 2.4.3 2006 PSF yes
2.5 2.4 2006 PSF yes
2.5.1 2.5 2007 PSF yes
2.6 2.5 2008 PSF yes
2.2 and above 2.1.1 2001-now PSF yes

Footnotes:

Expand Down Expand Up @@ -85,15 +68,15 @@ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
otherwise using this software ("Python") in source or binary form and
its associated documentation.

2. Subject to the terms and conditions of this License Agreement, PSF
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python
alone or in any derivative version, provided, however, that PSF's
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative
version prepared by Licensee.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation; All Rights
Reserved" are retained in Python alone or in any derivative version prepared by
Licensee.

3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
Expand Down Expand Up @@ -298,7 +281,7 @@ complies with this agreement, provided that you do not:
- alter any copyright, trademark or patent notice in Microsoft's
Distributable Code;

- use Microsofts trademarks in your programs names or in a way that
- use Microsoft's trademarks in your programs' names or in a way that
suggests your programs come from or are endorsed by Microsoft;

- distribute Microsoft's Distributable Code to run on a platform other
Expand All @@ -321,7 +304,7 @@ This copy of Python includes a copy of bzip2, which is licensed under the follow
--------------------------------------------------------------------------

This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2007 Julian R Seward. All
documentation, are copyright (C) 1996-2010 Julian R Seward. All
rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -356,7 +339,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Julian Seward, [email protected]
bzip2/libbzip2 version 1.0.5 of 10 December 2007
bzip2/libbzip2 version 1.0.6 of 6 September 2010

--------------------------------------------------------------------------

Expand Down Expand Up @@ -509,7 +492,7 @@ This copy of Python includes a copy of openssl, which is licensed under the foll
---------------

/* ====================================================================
* Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
* Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -661,7 +644,7 @@ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
Expand Down Expand Up @@ -698,12 +681,12 @@ MODIFICATIONS.

GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
Expand Down
Loading

0 comments on commit 181b56c

Please sign in to comment.