mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 13:14:37 +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
|
build
|
||||||
dist
|
dist
|
||||||
venv
|
venv
|
||||||
|
*.pyc
|
||||||
|
*.egg-info
|
||||||
|
__pycache__
|
||||||
|
.idea
|
||||||
|
.tox
|
||||||
|
.venv
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ language: python
|
|||||||
python: 3.6
|
python: 3.6
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install wheel flake8
|
- pip install wheel flake8 requests
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- flake8
|
- flake8
|
||||||
|
|||||||
@@ -29,6 +29,32 @@ Removed
|
|||||||
Security
|
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)
|
`v0.3.0`_ (8, March, 2019)
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
@@ -107,7 +133,8 @@ Fixed
|
|||||||
|
|
||||||
* Fork from https://git.kaidan.im/lnj/qli-installer
|
* 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.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.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
|
.. _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.archives import QtArchives
|
||||||
from aqt.installer import QtInstaller
|
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():
|
def main():
|
||||||
parser = argparse.ArgumentParser(prog='aqtinst', description='Install Qt SDK.',
|
parser = argparse.ArgumentParser(prog='aqtinst', description='Install Qt SDK.',
|
||||||
@@ -61,12 +56,7 @@ def main():
|
|||||||
exit(1)
|
exit(1)
|
||||||
qt_version = args.qt_version
|
qt_version = args.qt_version
|
||||||
|
|
||||||
# support proxy connection
|
QtInstaller(QtArchives(os_name, qt_version, target, arch)).install()
|
||||||
proxies = ProxyHandler({})
|
|
||||||
opener = build_opener(proxies)
|
|
||||||
install_opener(opener)
|
|
||||||
|
|
||||||
QtInstaller(QtArchives(os_name, qt_version, target, arch)).install(qt_version, arch)
|
|
||||||
|
|
||||||
sys.stdout.write("\033[K")
|
sys.stdout.write("\033[K")
|
||||||
print("Finished installation")
|
print("Finished installation")
|
||||||
|
|||||||
@@ -20,12 +20,8 @@
|
|||||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
# 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.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
import sys
|
|
||||||
import xml.etree.ElementTree as ElementTree
|
import xml.etree.ElementTree as ElementTree
|
||||||
if sys.version_info.major == 3:
|
import requests
|
||||||
from urllib.request import urlopen
|
|
||||||
else:
|
|
||||||
from urllib2 import urlopen
|
|
||||||
|
|
||||||
|
|
||||||
class QtPackage:
|
class QtPackage:
|
||||||
@@ -58,6 +54,9 @@ class QtArchives:
|
|||||||
archives = []
|
archives = []
|
||||||
|
|
||||||
def __init__(self, os_name, qt_version, target, arch):
|
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(".", "")
|
qt_ver_num = qt_version.replace(".", "")
|
||||||
if os_name == 'windows':
|
if os_name == 'windows':
|
||||||
archive_url = self.BASE_URL + os_name + '_x86/' + target + '/' + 'qt5_' + qt_ver_num + '/'
|
archive_url = self.BASE_URL + os_name + '_x86/' + target + '/' + 'qt5_' + qt_ver_num + '/'
|
||||||
@@ -66,8 +65,8 @@ class QtArchives:
|
|||||||
|
|
||||||
# Get packages index
|
# Get packages index
|
||||||
update_xml_url = "{0}Updates.xml".format(archive_url)
|
update_xml_url = "{0}Updates.xml".format(archive_url)
|
||||||
content = urlopen(update_xml_url).read()
|
r = requests.get(update_xml_url)
|
||||||
self.update_xml = ElementTree.fromstring(content)
|
self.update_xml = ElementTree.fromstring(r.text)
|
||||||
for packageupdate in self.update_xml.iter("PackageUpdate"):
|
for packageupdate in self.update_xml.iter("PackageUpdate"):
|
||||||
name = packageupdate.find("Name").text
|
name = packageupdate.find("Name").text
|
||||||
if name.split(".")[-1] != arch:
|
if name.split(".")[-1] != arch:
|
||||||
@@ -95,3 +94,6 @@ class QtArchives:
|
|||||||
|
|
||||||
def get_archives(self):
|
def get_archives(self):
|
||||||
return self.archives
|
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 platform
|
||||||
import sys
|
import sys
|
||||||
from multiprocessing.dummy import Pool
|
from multiprocessing.dummy import Pool
|
||||||
|
import requests
|
||||||
if sys.version_info.major == 3:
|
if sys.version_info.major == 3:
|
||||||
from urllib.request import urlretrieve
|
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
else:
|
else:
|
||||||
from urllib import urlretrieve
|
|
||||||
from subprocess import call as run
|
from subprocess import call as run
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +44,10 @@ class QtInstaller:
|
|||||||
url = package.get_url()
|
url = package.get_url()
|
||||||
sys.stdout.write("\033[K")
|
sys.stdout.write("\033[K")
|
||||||
print("-Downloading {}...".format(url))
|
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")
|
sys.stdout.write("\033[K")
|
||||||
print("-Extracting {}...".format(archive))
|
print("-Extracting {}...".format(archive))
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
@@ -58,7 +60,8 @@ class QtInstaller:
|
|||||||
def get_base_dir(qt_version):
|
def get_base_dir(qt_version):
|
||||||
return os.path.join(os.getcwd(), 'Qt{}'.format(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'):
|
if arch.startswith('win'):
|
||||||
arch_dir = arch[6:]
|
arch_dir = arch[6:]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ jobs:
|
|||||||
versionSpec: '3.6'
|
versionSpec: '3.6'
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
- script: |
|
- script: |
|
||||||
|
python -m pip install requests
|
||||||
python -m pip install flake8 twine wheel
|
python -m pip install flake8 twine wheel
|
||||||
flake8 .
|
flake8 .
|
||||||
displayName: 'Run lint tests'
|
displayName: 'Run lint tests'
|
||||||
@@ -25,6 +26,9 @@ jobs:
|
|||||||
arguments: $(qtversion) linux desktop
|
arguments: $(qtversion) linux desktop
|
||||||
workingDirectory: $(Build.BinariesDirectory)
|
workingDirectory: $(Build.BinariesDirectory)
|
||||||
displayName: install qt
|
displayName: install qt
|
||||||
|
- script: |
|
||||||
|
$(Build.BinariesDirectory)/Qt$(qtversion)/$(qtversion)/gcc_64/bin/qmake $(Build.SourcesDirectory)/tests
|
||||||
|
make
|
||||||
- script: python setup.py sdist bdist_wheel
|
- script: python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
- job: Ubuntu_1604_py2
|
- job: Ubuntu_1604_py2
|
||||||
@@ -38,6 +42,7 @@ jobs:
|
|||||||
- script: |
|
- script: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install p7zip
|
sudo apt-get -y install p7zip
|
||||||
|
python -m pip install requests
|
||||||
- task: PythonScript@0
|
- task: PythonScript@0
|
||||||
inputs:
|
inputs:
|
||||||
scriptSource: filePath
|
scriptSource: filePath
|
||||||
@@ -45,6 +50,9 @@ jobs:
|
|||||||
arguments: $(qtversion) linux desktop
|
arguments: $(qtversion) linux desktop
|
||||||
workingDirectory: $(Build.BinariesDirectory)
|
workingDirectory: $(Build.BinariesDirectory)
|
||||||
displayName: install qt
|
displayName: install qt
|
||||||
|
- script: |
|
||||||
|
$(Build.BinariesDirectory)/Qt$(qtversion)/$(qtversion)/gcc_64/bin/qmake $(Build.SourcesDirectory)/tests
|
||||||
|
make
|
||||||
- script: ls -lR $(Build.BinariesDirectory)
|
- script: ls -lR $(Build.BinariesDirectory)
|
||||||
|
|
||||||
- job: macOS
|
- job: macOS
|
||||||
@@ -55,7 +63,9 @@ jobs:
|
|||||||
inputs:
|
inputs:
|
||||||
versionSpec: '3.6'
|
versionSpec: '3.6'
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
- script: brew install p7zip
|
- script: |
|
||||||
|
brew install p7zip
|
||||||
|
python -m pip install requests
|
||||||
- task: PythonScript@0
|
- task: PythonScript@0
|
||||||
inputs:
|
inputs:
|
||||||
scriptSource: filePath
|
scriptSource: filePath
|
||||||
@@ -63,6 +73,9 @@ jobs:
|
|||||||
arguments: $(qtversion) mac desktop
|
arguments: $(qtversion) mac desktop
|
||||||
workingDirectory: $(Build.BinariesDirectory)
|
workingDirectory: $(Build.BinariesDirectory)
|
||||||
displayName: install qt
|
displayName: install qt
|
||||||
|
- script: |
|
||||||
|
$(Build.BinariesDirectory)/Qt$(qtversion)/$(qtversion)/clang_64/bin/qmake $(Build.SourcesDirectory)/tests
|
||||||
|
make
|
||||||
- script: ls -lR $(Build.BinariesDirectory)
|
- script: ls -lR $(Build.BinariesDirectory)
|
||||||
|
|
||||||
- job: Windows
|
- job: Windows
|
||||||
@@ -73,7 +86,9 @@ jobs:
|
|||||||
inputs:
|
inputs:
|
||||||
versionSpec: '3.6'
|
versionSpec: '3.6'
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
- script: cinst -y 7zip
|
- script: |
|
||||||
|
cinst -y 7zip
|
||||||
|
python -m pip install requests
|
||||||
- task: PythonScript@0
|
- task: PythonScript@0
|
||||||
inputs:
|
inputs:
|
||||||
scriptSource: filePath
|
scriptSource: filePath
|
||||||
|
|||||||
11
setup.py
11
setup.py
@@ -12,7 +12,7 @@ def readme():
|
|||||||
|
|
||||||
|
|
||||||
setup(name='aqtinstall',
|
setup(name='aqtinstall',
|
||||||
version='0.3.0',
|
version='0.3.1',
|
||||||
description='Another unofficial Qt installer',
|
description='Another unofficial Qt installer',
|
||||||
url='http://github.com/miurahr/aqtinstall',
|
url='http://github.com/miurahr/aqtinstall',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
@@ -20,5 +20,14 @@ setup(name='aqtinstall',
|
|||||||
author='Hioshi Miura',
|
author='Hioshi Miura',
|
||||||
author_email='miurahr@linux.com',
|
author_email='miurahr@linux.com',
|
||||||
packages=["aqt"],
|
packages=["aqt"],
|
||||||
|
install_requires=['requests'],
|
||||||
|
extras_require={
|
||||||
|
'dev': [
|
||||||
|
'pytest',
|
||||||
|
'pytest-pep8',
|
||||||
|
'pytest-cov',
|
||||||
|
'flake8'
|
||||||
|
]
|
||||||
|
},
|
||||||
scripts=["aqtinst"]
|
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