Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Python 3.8 #6355

Merged
merged 6 commits into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion conans/client/cmd/export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ast
import os
import shutil
import sys

import six

Expand All @@ -17,6 +18,7 @@
merge_directories
from conans.util.log import logger

isPY38 = bool(sys.version_info.major == 3 and sys.version_info.minor == 8)

def export_alias(package_layout, target_ref, output, revisions_enabled):
revision_mode = "hash"
Expand Down Expand Up @@ -303,7 +305,14 @@ def _replace_scm_data_in_conanfile(conanfile_path, scm_data):
else:
next_line = tree.body[i_body+1].lineno - 1
else:
next_line = statements[i+1].lineno - 1
# Next statement can be a comment or anything else
next_statement = statements[i+1]
if isPY38 and isinstance(next_statement, ast.Expr):
# Python 3.8 properly parses multiline comments with start and end lines,
# here we preserve the same (wrong) implementation of previous releases
next_line = next_statement.end_lineno - 1
else:
next_line = next_statement.lineno - 1
next_line_content = lines[next_line].strip()
if (next_line_content.endswith('"""') or
next_line_content.endswith("'''")):
Expand Down
7 changes: 5 additions & 2 deletions conans/server/service/v2/service_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from bottle import FileUpload, static_file

from conans.errors import RecipeNotFoundException, PackageNotFoundException
from conans.errors import RecipeNotFoundException, PackageNotFoundException, NotFoundException
from conans.server.service.common.common import CommonService
from conans.server.service.mime import get_mime_type
from conans.server.store.server_store import ServerStore
Expand All @@ -19,7 +19,10 @@ def __init__(self, authorizer, server_store):
# RECIPE METHODS
def get_recipe_file_list(self, ref, auth_user):
self._authorizer.check_read_conan(auth_user, ref)
file_list = self._server_store.get_recipe_file_list(ref)
try:
file_list = self._server_store.get_recipe_file_list(ref)
except NotFoundException:
raise RecipeNotFoundException(ref)
if not file_list:
raise RecipeNotFoundException(ref, print_rev=True)

Expand Down
17 changes: 10 additions & 7 deletions conans/test/functional/remote/multi_remote_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ class Pkg(ConanFile):
self.assertIn("Probably it was installed from a remote that is no longer available.",
client2.out)

# Failure because remote is disconnected
client2 = TestClient(servers=servers, users={"new_server": [("user", "password")]})
# Failure because remote removed the package
client2 = TestClient(servers=servers, users={"new_server": [("user", "password")],
"default": [("user", "password")]})
client2.run("install pkg/0.1@user/testing")
client2.run("remote add default http://someweird__conan_URL -f")
client2.run("remove * -r=default -f")
client2.run("upload pkg/0.1@user/testing --all -r=new_server", assert_error=True)
self.assertIn("Unable to connect to default=http://someweird__conan_URL", client2.out)
self.assertIn("ERROR: Recipe not found: 'pkg/0.1@user/testing'. [Remote: default]",
client2.out)
self.assertIn("The 'pkg/0.1@user/testing' package has 'exports_sources' but sources "
"not found in local cache.", client2.out)
self.assertIn("Probably it was installed from a remote that is no longer available.",
Expand All @@ -57,7 +59,8 @@ def setUp(self):
self.servers["default"] = default_server
self.servers["local"] = local_server

def _create(self, client, number, version, deps=None, export=True, modifier=""):
@staticmethod
def _create(client, number, version, deps=None, export=True, modifier=""):
files = cpp_hello_conan_files(number, version, deps, build=False)
# To avoid building
files = {CONANFILE: files[CONANFILE].replace("config(", "config2(") + modifier}
Expand Down Expand Up @@ -243,13 +246,13 @@ def fail_when_not_notfound_test(self):
client.run("user lasote -p mypass -r s1")
client.run("upload MyLib* -r s1 -c")

servers["s1"].fake_url = "http://asdlhaljksdhlajkshdljakhsd" # Do not exist
servers["s1"].fake_url = "http://asdlhaljksdhlajkshdljakhsd.com" # Do not exist
client2 = TestClient(servers=servers, users=self.users)
err = client2.run("install MyLib/0.1@conan/testing --build=missing", assert_error=True)
self.assertTrue(err)
self.assertIn("MyLib/0.1@conan/testing: Trying with 's0'...", client2.out)
self.assertIn("MyLib/0.1@conan/testing: Trying with 's1'...", client2.out)
self.assertIn("Unable to connect to s1=http://asdlhaljksdhlajkshdljakhsd", client2.out)
self.assertIn("Unable to connect to s1=http://asdlhaljksdhlajkshdljakhsd.com", client2.out)
# s2 is not even tried
self.assertNotIn("MyLib/0.1@conan/testing: Trying with 's2'...", client2.out)

Expand Down
4 changes: 3 additions & 1 deletion conans/util/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ def gzopen_without_timestamps(name, mode="r", fileobj=None, compresslevel=None,
raise

try:
t = tarfile.TarFile.taropen(name, mode, fileobj, **kwargs)
# Format is forced because in Python3.8, it changed and it generates different tarfiles
# with different checksums, which break hashes of tgzs
t = tarfile.TarFile.taropen(name, mode, fileobj, format=tarfile.GNU_FORMAT, **kwargs)
except IOError:
fileobj.close()
if mode == 'r':
Expand Down