shedskin / shedskin

Shed Skin is a restricted-Python-to-C++ compiler. Read the introduction below to learn about the restrictions.
https://shedskin.github.io/
Other
830 stars 105 forks source link

Windows Install and Test #514

Open sistemicorp opened 4 days ago

sistemicorp commented 4 days ago

Struggling to install and build test.py on Windows. I search all issues.
Using Python 3.12.

I did install conan==1.62.0.

The linux instructions have sudo apt-get install shedskin which there is no equivalent on Windows. So I cloned shedskin repo.

Was able to run setup.py, and it seemed to finish,

(.venv) C:\git\shedskin>python setup.py install
running install
 ...
Extracting shedskin-0.0.0-py3.12.egg to c:\git\shedskin\.venv\lib\site-packages
c:\git\shedskin\.venv\lib\site-packages\shedskin-0.0.0-py3.12.egg\shedskin\makefile.py:64: SyntaxWarning: invalid escape sequence '\ '
  esc_space = "\ "
Adding shedskin 0.0.0 to easy-install.pth file

Installed c:\git\shedskin\.venv\lib\site-packages\shedskin-0.0.0-py3.12.egg
Processing dependencies for shedskin==0.0.0
Finished processing dependencies for shedskin==0.0.0

But cannot run the build,

(.venv) C:\git\shedskin>python shedskin build --conan test
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\git\shedskin\shedskin\__main__.py", line 8, in <module>
    from . import Shedskin
ImportError: attempted relative import with no known parent package

As a side note, got two warnings when running setup.py,

(.venv) C:\git\shedskin>python setup.py install
running install
C:\git\shedskin\.venv\Lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
C:\git\shedskin\.venv\Lib\site-packages\setuptools\_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
sistemicorp commented 4 days ago

okay, I fixed it, already, needed -m,

(.venv) C:\git\shedskin>python -m shedskin build --conan test

Maybe the docs can be updated, or just close this, this solution is searchable now.

sistemicorp commented 4 days ago

Next bump in the road,

...
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: C:/git/shedskin/build
bld_cmd: cmake --build C:\git\shedskin\build
MSBuild version 17.7.2+d6990bcfa for .NET Framework

  1>Checking Build System
  translating test.py to exe
  'shedskin' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(249,5): error MSB8066: Custom build for 'C:\git\shedskin\build\CMa
keFiles\f0254fdbe7ebff048efd60e26cd13bd8\test.cpp.rule;C:\git\shedskin\CMakeLists.txt' exited with code 9009. [C:\git\shedskin\build\test-exe.vcxproj]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\git\shedskin\shedskin\__main__.py", line 16, in <module>
    run()
  File "C:\git\shedskin\shedskin\__main__.py", line 12, in run
    Shedskin.commandline()
  File "C:\git\shedskin\shedskin\__init__.py", line 406, in commandline
    ss.build()
  File "C:\git\shedskin\shedskin\__init__.py", line 192, in build
    builder.build()
  File "C:\git\shedskin\shedskin\cmake.py", line 691, in build
    self.process(run_tests=False)
  File "C:\git\shedskin\shedskin\cmake.py", line 816, in process
    self.cmake_build(bld_options)
  File "C:\git\shedskin\shedskin\cmake.py", line 671, in cmake_build
    assert os.system(bld_cmd) == 0
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

I think the problem is 'shedskin' is not recognized as an internal or external command Digging into it... Maybe this file helps debug, test-exe.vcxproj.zip

srepmub commented 1 day ago

sorry for the late reaction! :S and thanks for the feedback.

did you try installing shedskin using 'pip install .'..? using 'setup.py install' is deprecated, hence the warnings.

let's update the documentation for this in any case, since you are not the first to run into this.