cloudbase / cloudbase-init

Cross-platform instance initialization
http://openstack.org
Apache License 2.0
421 stars 149 forks source link

Python 3.8 Warnings/Error #23

Closed rgl closed 4 years ago

rgl commented 4 years ago

I'm trying to use Python 3.8 in Windows, and while running python setup.py install is gave some warnings/errors that should be reviewed:

C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\metadata\services\osconfigdrive\test_factory.py:38: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if platform is not "win32":

byte-compiling C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\osutils\test_windows.py to test_windows.cpython-38.pyc
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\osutils\test_windows.py:323: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if ret_value is not 0 and is_in_alias:

byte-compiling C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py to test_winrmconfig.cpython-38.pyc
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:87: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if tag is "ListeningOn":
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:89: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif tag is "Enabled":
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:90: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if text is 'true':
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:96: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif tag is 'Port':
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:145: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if tag is "Enabled":
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:146: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if text is 'true':

Can these be fixed like python is suggesting?

Also there's an issue with using the async reserved keyword as a variable:

byte-compiling C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py to vds_storage_manager.cpython-38.pyc
  File "C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 94
    async = volume.Extend(input_disks_ar, len(input_disks))
          ^
SyntaxError: invalid syntax

Should I post a PR fixing these?

ader1990 commented 4 years ago

@rgl I need to add first the CI to run py38 and then the fixes can be added. You can create the change and I ll happily add it to the review system.

ader1990 commented 4 years ago

Also, before adding support for 3.8, we need wheels for pymi.

rgl commented 4 years ago

@ader1990 I will create a PR about the warnings :-)

BTW, I'm not sure if this is the best place to ask... but I'm trying to make the cloudinit-base footprint smaller by using python "embed" and putting all the py/pyc files inside a zip file and the .pyd (native DLLs) out of the zip as I described at https://gist.github.com/rgl/72b60fc12f91c93c0d286d56ae19e324; but I'm currently stuck at the last step. Can you please take a look? Maybe you already known how to do it :-)

BTW, I'm also using the petrutlucian94/pymi repo because it can be built with latest Visual Studio 2019 Build Tools.

ader1990 commented 4 years ago

This issue is solved by https://review.opendev.org/#/c/696565/ for python 3.7. I will make a patch for 3.8 when I have a an automated ci/gate to test it.

ader1990 commented 4 years ago

@ader1990 I will create a PR about the warnings :-)

BTW, I'm not sure if this is the best place to ask... but I'm trying to make the cloudinit-base footprint smaller by using python "embed" and putting all the py/pyc files inside a zip file and the .pyd (native DLLs) out of the zip as I described at https://gist.github.com/rgl/72b60fc12f91c93c0d286d56ae19e324; but I'm currently stuck at the last step. Can you please take a look? Maybe you already known how to do it :-)

BTW, I'm also using the petrutlucian94/pymi repo because it can be built with latest Visual Studio 2019 Build Tools.

This would be very cool. Currently, I do not have any input on this matter, but it would be great if you could make a how-to if you get it working.