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

Fix encoding error while creating executables on Windows #1685

Merged
merged 1 commit into from
Jan 20, 2017

Conversation

nicoddemus
Copy link
Contributor

@nicoddemus nicoddemus commented Jan 20, 2017

As commented in #1632, the waf build still fails in the latest version.

I tried the PR locally on my machine and I can confirm that the recipe for waf now builds correctly.

For the record, here's a snipped of the bottom of the waf-script.py file which causes the problem:

wafdir = find_lib()
sys.path.insert(0, wafdir)

if __name__ == '__main__':

	from waflib import Scripting
	Scripting.waf_entry_point(cwd, VERSION, wafdir)

#==>
#BZh91AY&SYî?l��lv�þÿ°#.Ó�ÿÿÿÿÿÿÿÿÿÿÿ??Y@�Â?��%H4à?b�<g^è?#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.�ù�??�d\?mÏ??[*DU�ï?]??Ü2\??uö�º??#1µ?vÝå?{µuÛí??R{?#/?ìb?ïG�??íÕ??9M=p?#.4ò{?ÐkA�ìôz?m?nwzmïzô?µÓ]mô{Á??]îìç?ÝÛÞìåºÜzë?4�?ûîç{yöàú#.?<mî?îí;Ý??{íß�o?wÝ7=Û?µï?#.#.�Ð�?qtÐ�ÁÈû?#.FT?�?À�{ç�Ë?:

I don't know about waf (internals or otherwise), but I guess the scripts reads that binary data from itself during runtime for some purpose.

cc @tarcisiofischer @jakirkham @msarahan

Fix #1632

Depending on the contents of the exe-scripts, trying to guess an encoding is
dangerous, best handling everything in binary at this point.

Fix conda#1632
@msarahan
Copy link
Contributor

Yikes, that makes a lot of sense now. I'm a little horrified by the need for this, but very grateful that you've figured it out. Waiting on AppVeyor, and will merge assuming success. Thanks!

@nicoddemus
Copy link
Contributor Author

py27 passed on AppVeyor, while the other builds failed with:

__________________________ test_repo[perl-cpan-Moo-] __________________________
[gw0] win32 -- Python 3.4.5 C:\Miniconda3-x64\python.exe
Traceback (most recent call last):
  File "C:\projects\conda-build\conda_build\skeletons\cpan.py", line 162, in get_cpan_api_url
    output = dist_json_file.read()
  File "C:\Miniconda3-x64\lib\gzip.py", line 360, in read
    while self._read(readsize):
  File "C:\Miniconda3-x64\lib\gzip.py", line 433, in _read
    if not self._read_gzip_header():
  File "C:\Miniconda3-x64\lib\gzip.py", line 297, in _read_gzip_header
    raise OSError('Not a gzipped file')
OSError: Not a gzipped file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\projects\conda-build\tests\test_api_skeleton.py", line 21, in test_repo
    api.skeletonize(package, repo, version=version, output_dir=testing_workdir, config=test_config)
  File "C:\projects\conda-build\conda_build\api.py", line 201, in skeletonize
    recursive=recursive, config=config, **kwargs)
  File "C:\projects\conda-build\conda_build\skeletons\cpan.py", line 302, in skeletonize
    recursive=recursive, config=config)
  File "C:\projects\conda-build\conda_build\skeletons\cpan.py", line 481, in deps_for_package
    perl_version, config=config)
  File "C:\Miniconda3-x64\lib\site-packages\conda\utils.py", line 45, in __call__
    value = self.func(*args, **kw)
  File "C:\projects\conda-build\conda_build\skeletons\cpan.py", line 553, in dist_for_module
    rel_dict = get_cpan_api_url('{0}/v0/release/{1}'.format(cpan_url, module), colons=False)
  File "C:\projects\conda-build\conda_build\skeletons\cpan.py", line 167, in get_cpan_api_url
    rel_dict = json.loads(open(json_path).read())
  File "C:\Miniconda3-x64\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 10876: character maps to <undefined>

That does not seem to be related to my change though. @msarahan is that test failure a fluke perhaps?

@nicoddemus
Copy link
Contributor Author

Really seems like a fluke since #1686 also had the same errors on AppVeyor.

@msarahan
Copy link
Contributor

Yeah, it's a fluke - or rather, something this PR didn't cause, but something I need to fix elsewhere. Thanks again for this PR. Merging.

@msarahan msarahan merged commit 3664762 into conda:master Jan 20, 2017
@nicoddemus
Copy link
Contributor Author

OK, thanks!

@nicoddemus nicoddemus deleted the win_exe_encoding branch January 20, 2017 14:29
@github-actions
Copy link

github-actions bot commented May 6, 2022

Hi there, thank you for your contribution!

This pull request has been automatically locked because it has not had recent activity after being closed.

Please open a new issue or pull request if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label May 6, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encoding issues on Windows build in the fix_staged_scripts step
2 participants