Fix issue #65: Check source directories exist before writing to requirements#66
Merged
Fix issue #65: Check source directories exist before writing to requirements#66
Conversation
7c520bf to
5dbbd87
Compare
…rements When using mxdev -n (no-fetch) or in offline mode, source directories may not exist yet. Previously, mxdev would write references like '-e ./sources/package' to requirements-mxdev.txt regardless, causing pip install to fail later. This fix checks if source directories exist before writing them: - If directory exists: Write normally (existing behavior) - If directory doesn't exist: Write as comment with contextual warning The warning message adapts based on context: - In offline mode: Mentions offline mode and suggests removing -n and --offline flags - Normal mode: Suggests removing -n flag to fetch sources This fixes the mxmake two-stage installation workflow where mxdev -n runs before sources are checked out. Changes: - Update write_dev_sources() to accept State parameter and check path existence - Add contextual warning messages for missing directories - Add tests for missing directories and offline mode warnings - Update existing tests to pass State parameter Fixes #65
In offline mode: - Missing sources log WARNING (expected) - Packages written as comments - mxdev continues In non-offline mode: - Missing sources log ERROR (fatal) - Packages written as comments - mxdev raises RuntimeError and exits This prevents silent failures when sources fail to checkout and makes mxmake two-stage installation more robust. Tests: - Updated test_write_dev_sources_missing_directories to use offline mode - Added test_write_dev_sources_missing_directories_raises_error - All 7 write_dev_sources tests pass
During rebase conflict resolution, test_process_line_package_in_override_keys and test_process_line_package_in_ignore_keys were accidentally duplicated. Removed duplicates, keeping only one copy of each test.
84f7555 to
4232ca6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #65 - mxdev now checks if source directories exist before writing them to requirements-mxdev.txt, with different behavior based on offline mode.
Problem
When using
mxdev -n(no-fetch) or in offline mode, source directories may not exist yet. Previously, mxdev would write references like-e ./sources/packageto requirements-mxdev.txt regardless, causing pip install to fail with "directory does not exist" errors.This breaks the mxmake two-stage installation workflow:
mxdev -nto generate requirements file-e ./sources/packageeven though sources don't existSolution
Modified
write_dev_sources()to check if source directories exist with different behavior based on mode:Offline Mode (expected missing sources)
Non-Offline Mode (unexpected missing sources = fatal error)
This prevents silent failures when sources fail to checkout.
Changes
write_dev_sources()to accept State parameter and checkPath(package["path"]).exists()# -e ./sources/package # mxdev: source not checked outTesting
✅ All write_dev_sources tests pass (7/7)
test_write_dev_sources_missing_directories- now uses offline mode explicitlytest_write_dev_sources_missing_directories_raises_error- verifies RuntimeError in non-offline modetest_write_dev_sources_missing_directories_offline_mode- verifies offline-specific warningBenefits