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

example.c "craftr export" fails with "ValueError: a target with the name 'examples.c-1.0.0.program' already exists" #188

Closed
ompadu opened this issue Sep 13, 2017 · 6 comments

Comments

@ompadu
Copy link

ompadu commented Sep 13, 2017

Platform: Windows 10.0.15063 x64
Visual Studio version: 15.3.4
Python version: 3.6.2
craftr version: 2.0.0

After I've installed craftr with "pip install craftr-build==2.0.0", I've downloaded the craftr v.2.0.0 release, opened the "x64 Native Tools Command Prompt for VS 2017", navigated to the example.c folder and tried to run craftr export. It failed with the following output:

D:\<workspace>\GIT\craftr\examples\examples.c>craftr export
Loading CXX Toolkit "craftr.lang.cxx.msvc" (with craftr.lang.cxx.msvc.toolkit="")                                                                  (craftr.lang.cxx:33)
  cxc.name="msvc"                                                                                                                                  (craftr.lang.cxx:36)
  cxc.target_arch="x64"                                                                                                                            (craftr.lang.cxx:37)
  cxc.version="19.11.25508.2"                                                                                                                      (craftr.lang.cxx:38)
Traceback (most recent call last):
  File "C:\Users\<user_name>\AppData\Local\Programs\Python\Python36\Scripts\craftr-script.py", line 11, in <module>
    load_entry_point('craftr-build==2.0.0', 'console_scripts', 'craftr')()
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\__main__.py", line 812, in main_and_exit
    sys.exit(main())
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\__main__.py", line 808, in main
    return commands[args.command].execute(parser, args)
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\__main__.py", line 224, in wrapper
    return func(*args, **kwargs)
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\__main__.py", line 334, in execute
    return self._export_run_or_help(args, module)
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\__main__.py", line 400, in _export_run_or_help
    module.run()
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\core\session.py", line 491, in run
    exec(code, vars(self.namespace))
  File "d:\<workspace>\git\craftr\examples\examples.c\craftrfile", line 22, in <module>
    output = 'main'
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\stl\craftr.lang.cxx\craftrfile", line 66, in executable
    return cxc.link(*args, name=gtn(name, None), output_type='bin', **kwargs)
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\stl\craftr.lang.cxx.msvc\craftrfile", line 522, in link
    description='{} link ($out)'.format(self.info['name']))
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\targetbuilder.py", line 260, in build
    session.graph.add_target(target)
  File "c:\users\<user_name>\appdata\local\programs\python\python36\lib\site-packages\craftr\core\build.py", line 127, in add_target
    .format(target.name))
ValueError: a target with the name 'examples.c-1.0.0.program' already exists

D:\<workspace>\GIT\craftr\examples\examples.c>

example.cpp "craftr export" fails with the same output. For example.csharp both export and build work.

@ompadu
Copy link
Author

ompadu commented Sep 14, 2017

No Python 3.6 support. I've missed that. My bad. That's why it failed.

@NiklasRosenstein
Copy link
Collaborator

Hi! Yes that's related to #186. It's only due to the automatic target name deduction which behaves different in Python 3.6. If you give every target a name, it works.

@ompadu
Copy link
Author

ompadu commented Sep 14, 2017

Thanks for the workaround!

I see that the 3.x branch targets Py3.6 but is there any chance a fix would come into 2.x? And while we are on the 3.x subject, will that branch eventually support setuptools or target nodepy only?

@NiklasRosenstein
Copy link
Collaborator

The 3.x branch will be a whole new version of Craftr :^) I do plan to fix #186 for Craftr 2.x though. Hopefully very soon.

@NiklasRosenstein
Copy link
Collaborator

Oh and for the time being, Craftr 3.x is not planned to be installable via setuptools, however it may be possible to make setup.py install Node.py and then proceed with the installation. That is for the future though, and when 3.x is usable.

@NiklasRosenstein
Copy link
Collaborator

It appears it was simpler than I thought it would be to fix #186. Until there is no version with the fix on PyPI, you can simply upgrade the nr package.

$ pip install --upgrade 'nr>=1.4.7'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants