#31 Setuptools `build` command requires `version_info.json` file but does not create it
Closed: Fixed 5 years ago by bignose. Opened 5 years ago by slev.

I'm trying to build python-module-daemon-2.2.3 on RPM-based distro.
Build fails with:

+ /usr/bin/python setup.py build                                                
running build                                                                   
running build_py                                                                
creating build                                                                  
creating build/lib                                                              
creating build/lib/daemon                                                       
copying daemon/runner.py -> build/lib/daemon                                    
copying daemon/pidfile.py -> build/lib/daemon                                   
copying daemon/daemon.py -> build/lib/daemon                                    
copying daemon/_metadata.py -> build/lib/daemon                                 
copying daemon/__init__.py -> build/lib/daemon                                  
running write_version_info                                                      
writing version info to python_daemon.egg-info/version_info.json                
error: [Errno 2] No such file or directory: u'python_daemon.egg-info/version_info.json'
error: Bad exit status from /usr/src/tmp/rpm-tmp.12404 (%build)

Important note: sources were taken from git VCS.
If manually build "sdist" before "build" then all are happy.
That means if we have python_daemon.egg-info directory with all related files in the project root, we are OK.

The previous version built here is 2.1.2 and has no build problems.


Also, one can issue python setup.py egg_info to workaround.

Can you try the changes in the branch wip/issue/31/setup-commands-egg-info to see whether that addresses the problem for you?

Metadata Update from @bignose:
- Issue assigned to bignose

5 years ago

@bignose , yes, that helps to build without workarounds.
But testing fails:

py36 runtests: commands[0] | /usr/src/RPM/BUILD/python-module-daemon-2.2.3/.tox/py36/bin/python -m setup test --quiet
  /usr/src/RPM/BUILD/python-module-daemon-2.2.3$ /usr/src/RPM/BUILD/python-module-daemon-2.2.3/.tox/py36/bin/python -m setup test --quiet 
running test
running egg_info
writing python_daemon.egg-info/PKG-INFO
writing dependency_links to python_daemon.egg-info/dependency_links.txt
writing requirements to python_daemon.egg-info/requires.txt
writing top-level names to python_daemon.egg-info/top_level.txt
reading manifest file 'python_daemon.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'pyproject.toml'
writing manifest file 'python_daemon.egg-info/SOURCES.txt'
running build_ext
/usr/src/RPM/BUILD/python-module-daemon-2.2.3/daemon/daemon.py:798: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_RAW, proto=0>
  if is_socket(stdin_fd):
.....................................................................................................................................................s.................s...........................................................................................FF...............................................................................................
======================================================================
FAIL: test_returns_none (test_version.EggInfoCommand_run_TestCase)
test_version.EggInfoCommand_run_TestCase.test_returns_none
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/usr/src/RPM/BUILD/python-module-daemon-2.2.3/test_version.py", line 1541, in test_returns_none
    self.assertIs(result, None)
  File "/usr/lib/python3/site-packages/testtools/testcase.py", line 445, in assertIs
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/site-packages/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: None is not <MagicMock name='run()' id='140129735130136'>

======================================================================
FAIL: test_runs_each_command_in_sub_commands (test_version.EggInfoCommand_run_TestCase)
test_version.EggInfoCommand_run_TestCase.test_runs_each_command_in_sub_commands
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/usr/src/RPM/BUILD/python-module-daemon-2.2.3/test_version.py", line 1549, in test_runs_each_command_in_sub_commands
    base_command.run_command.assert_has_calls(expected_calls)
  File "/usr/lib/python3/site-packages/mock/mock.py", line 969, in assert_has_calls
    ), cause)
  File "<string>", line 3, in raise_from
AssertionError: Calls not found.
Expected: [call('spam'), call('eggs'), call('beans')]
Actual: []


----------------------------------------------------------------------
Ran 356 tests in 1.418s

FAILED (failures=2, skipped=2)

Metadata Update from @bignose:
- Issue tagged with: install

5 years ago

slev wrote:

But testing fails

Thanks. I have re-worked that branch and updated the test cases for the new behaviour.

Please try the branch wip/issue/31/setup-commands-egg-info to see whether that passes tests, and corrects the build step for your case.

Thank you for the quick fix (build - OK, tests - PASSED).
I'm happy :)

Thanks for verifying the bug fix.

This is now addressed in master as of commit 9c9d90f, and will be part of the next release.

Metadata Update from @bignose:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

5 years ago

Login to comment on this ticket.

Metadata