mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 05:04:38 +03:00
Merge pull request #21 from miurahr/dev03
Update http client library to requests
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,4 +1,9 @@
|
||||
.venv
|
||||
build
|
||||
dist
|
||||
venv
|
||||
*.pyc
|
||||
*.egg-info
|
||||
__pycache__
|
||||
.idea
|
||||
.tox
|
||||
.venv
|
||||
|
||||
@@ -2,7 +2,7 @@ language: python
|
||||
python: 3.6
|
||||
|
||||
install:
|
||||
- pip install wheel flake8
|
||||
- pip install wheel flake8 requests
|
||||
|
||||
script:
|
||||
- flake8
|
||||
|
||||
@@ -29,6 +29,32 @@ Removed
|
||||
Security
|
||||
--------
|
||||
|
||||
`v0.3.1`_ (15, March, 2019)
|
||||
==========================
|
||||
|
||||
Added
|
||||
-----
|
||||
|
||||
* Qmake build test code in CI environment.(#14)
|
||||
|
||||
Fixed
|
||||
-----
|
||||
|
||||
* Connect to Qt download server through proxy with authentication.(#17)
|
||||
|
||||
Changed
|
||||
-------
|
||||
|
||||
* Change QtInstaller.install() function signature not to take any parameter.
|
||||
* Replace standard urllib to requests library.(#18)
|
||||
* Use 7zr external command instead of 7z in Linux and mac OSX envitonment.
|
||||
|
||||
Removed
|
||||
-------
|
||||
|
||||
* requirements.txt file.
|
||||
|
||||
|
||||
`v0.3.0`_ (8, March, 2019)
|
||||
==========================
|
||||
|
||||
@@ -107,7 +133,8 @@ Fixed
|
||||
|
||||
* Fork from https://git.kaidan.im/lnj/qli-installer
|
||||
|
||||
.. _Unreleased: https://github.com/miurahr/qli-installer/compare/v0.3.0...HEAD
|
||||
.. _Unreleased: https://github.com/miurahr/qli-installer/compare/v0.3.1...HEAD
|
||||
.. _v0.3.1: https://github.com/miurahr/qli-installer/compare/v0.3.0...v0.3.1
|
||||
.. _v0.3.0: https://github.com/miurahr/qli-installer/compare/v0.2.0...v0.3.0
|
||||
.. _v0.2.0: https://github.com/miurahr/qli-installer/compare/v0.1.0...v0.2.0
|
||||
.. _v0.1.0: https://github.com/miurahr/qli-installer/compare/v0.0.2...v0.1.0
|
||||
|
||||
@@ -26,11 +26,6 @@ import sys
|
||||
from aqt.archives import QtArchives
|
||||
from aqt.installer import QtInstaller
|
||||
|
||||
if sys.version_info.major == 3:
|
||||
from urllib.request import ProxyHandler, build_opener, install_opener
|
||||
else:
|
||||
from urllib2 import ProxyHandler, build_opener, install_opener
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(prog='aqtinst', description='Install Qt SDK.',
|
||||
@@ -61,12 +56,7 @@ def main():
|
||||
exit(1)
|
||||
qt_version = args.qt_version
|
||||
|
||||
# support proxy connection
|
||||
proxies = ProxyHandler({})
|
||||
opener = build_opener(proxies)
|
||||
install_opener(opener)
|
||||
|
||||
QtInstaller(QtArchives(os_name, qt_version, target, arch)).install(qt_version, arch)
|
||||
QtInstaller(QtArchives(os_name, qt_version, target, arch)).install()
|
||||
|
||||
sys.stdout.write("\033[K")
|
||||
print("Finished installation")
|
||||
|
||||
@@ -20,12 +20,8 @@
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
if sys.version_info.major == 3:
|
||||
from urllib.request import urlopen
|
||||
else:
|
||||
from urllib2 import urlopen
|
||||
import requests
|
||||
|
||||
|
||||
class QtPackage:
|
||||
@@ -58,6 +54,9 @@ class QtArchives:
|
||||
archives = []
|
||||
|
||||
def __init__(self, os_name, qt_version, target, arch):
|
||||
self.qt_version = qt_version
|
||||
self.target = target
|
||||
self.arch = arch
|
||||
qt_ver_num = qt_version.replace(".", "")
|
||||
if os_name == 'windows':
|
||||
archive_url = self.BASE_URL + os_name + '_x86/' + target + '/' + 'qt5_' + qt_ver_num + '/'
|
||||
@@ -66,8 +65,8 @@ class QtArchives:
|
||||
|
||||
# Get packages index
|
||||
update_xml_url = "{0}Updates.xml".format(archive_url)
|
||||
content = urlopen(update_xml_url).read()
|
||||
self.update_xml = ElementTree.fromstring(content)
|
||||
r = requests.get(update_xml_url)
|
||||
self.update_xml = ElementTree.fromstring(r.text)
|
||||
for packageupdate in self.update_xml.iter("PackageUpdate"):
|
||||
name = packageupdate.find("Name").text
|
||||
if name.split(".")[-1] != arch:
|
||||
@@ -95,3 +94,6 @@ class QtArchives:
|
||||
|
||||
def get_archives(self):
|
||||
return self.archives
|
||||
|
||||
def get_target_config(self):
|
||||
return self.qt_version, self.target, self.arch
|
||||
|
||||
@@ -24,11 +24,10 @@ import os
|
||||
import platform
|
||||
import sys
|
||||
from multiprocessing.dummy import Pool
|
||||
import requests
|
||||
if sys.version_info.major == 3:
|
||||
from urllib.request import urlretrieve
|
||||
from subprocess import run
|
||||
else:
|
||||
from urllib import urlretrieve
|
||||
from subprocess import call as run
|
||||
|
||||
|
||||
@@ -45,7 +44,10 @@ class QtInstaller:
|
||||
url = package.get_url()
|
||||
sys.stdout.write("\033[K")
|
||||
print("-Downloading {}...".format(url))
|
||||
urlretrieve(url, archive)
|
||||
r = requests.get(url, stream=True)
|
||||
with open(archive, 'wb') as fd:
|
||||
for chunk in r.iter_content(chunk_size=8196):
|
||||
fd.write(chunk)
|
||||
sys.stdout.write("\033[K")
|
||||
print("-Extracting {}...".format(archive))
|
||||
if platform.system() == 'Windows':
|
||||
@@ -58,7 +60,8 @@ class QtInstaller:
|
||||
def get_base_dir(qt_version):
|
||||
return os.path.join(os.getcwd(), 'Qt{}'.format(qt_version))
|
||||
|
||||
def install(self, qt_version, arch):
|
||||
def install(self):
|
||||
qt_version, target, arch = self.qt_archives.get_target_config()
|
||||
if arch.startswith('win'):
|
||||
arch_dir = arch[6:]
|
||||
else:
|
||||
|
||||
@@ -12,6 +12,7 @@ jobs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
- script: |
|
||||
python -m pip install requests
|
||||
python -m pip install flake8 twine wheel
|
||||
flake8 .
|
||||
displayName: 'Run lint tests'
|
||||
@@ -25,6 +26,9 @@ jobs:
|
||||
arguments: $(qtversion) linux desktop
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
displayName: install qt
|
||||
- script: |
|
||||
$(Build.BinariesDirectory)/Qt$(qtversion)/$(qtversion)/gcc_64/bin/qmake $(Build.SourcesDirectory)/tests
|
||||
make
|
||||
- script: python setup.py sdist bdist_wheel
|
||||
|
||||
- job: Ubuntu_1604_py2
|
||||
@@ -38,6 +42,7 @@ jobs:
|
||||
- script: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install p7zip
|
||||
python -m pip install requests
|
||||
- task: PythonScript@0
|
||||
inputs:
|
||||
scriptSource: filePath
|
||||
@@ -45,6 +50,9 @@ jobs:
|
||||
arguments: $(qtversion) linux desktop
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
displayName: install qt
|
||||
- script: |
|
||||
$(Build.BinariesDirectory)/Qt$(qtversion)/$(qtversion)/gcc_64/bin/qmake $(Build.SourcesDirectory)/tests
|
||||
make
|
||||
- script: ls -lR $(Build.BinariesDirectory)
|
||||
|
||||
- job: macOS
|
||||
@@ -55,7 +63,9 @@ jobs:
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
- script: brew install p7zip
|
||||
- script: |
|
||||
brew install p7zip
|
||||
python -m pip install requests
|
||||
- task: PythonScript@0
|
||||
inputs:
|
||||
scriptSource: filePath
|
||||
@@ -63,6 +73,9 @@ jobs:
|
||||
arguments: $(qtversion) mac desktop
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
displayName: install qt
|
||||
- script: |
|
||||
$(Build.BinariesDirectory)/Qt$(qtversion)/$(qtversion)/clang_64/bin/qmake $(Build.SourcesDirectory)/tests
|
||||
make
|
||||
- script: ls -lR $(Build.BinariesDirectory)
|
||||
|
||||
- job: Windows
|
||||
@@ -73,7 +86,9 @@ jobs:
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
- script: cinst -y 7zip
|
||||
- script: |
|
||||
cinst -y 7zip
|
||||
python -m pip install requests
|
||||
- task: PythonScript@0
|
||||
inputs:
|
||||
scriptSource: filePath
|
||||
|
||||
11
setup.py
11
setup.py
@@ -12,7 +12,7 @@ def readme():
|
||||
|
||||
|
||||
setup(name='aqtinstall',
|
||||
version='0.3.0',
|
||||
version='0.3.1',
|
||||
description='Another unofficial Qt installer',
|
||||
url='http://github.com/miurahr/aqtinstall',
|
||||
license='MIT',
|
||||
@@ -20,5 +20,14 @@ setup(name='aqtinstall',
|
||||
author='Hioshi Miura',
|
||||
author_email='miurahr@linux.com',
|
||||
packages=["aqt"],
|
||||
install_requires=['requests'],
|
||||
extras_require={
|
||||
'dev': [
|
||||
'pytest',
|
||||
'pytest-pep8',
|
||||
'pytest-cov',
|
||||
'flake8'
|
||||
]
|
||||
},
|
||||
scripts=["aqtinst"]
|
||||
)
|
||||
|
||||
9
tests/hello.pro
Normal file
9
tests/hello.pro
Normal file
@@ -0,0 +1,9 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = Hello
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
12
tests/main.cpp
Normal file
12
tests/main.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app (argc, argv);
|
||||
|
||||
QPushButton button ("Hello world !");
|
||||
button.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user