python-package-folder 4.3.0__py3-none-any.whl → 4.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ const path = require('path');
26
26
  const fs = require('fs');
27
27
  const https = require('https');
28
28
  const http = require('http');
29
+ const { execSync } = require('child_process');
29
30
 
30
31
  // Parse command line arguments
31
32
  const args = process.argv.slice(2);
@@ -310,48 +311,102 @@ async function queryRegistryVersion(packageName, repository, repositoryUrl) {
310
311
  return null;
311
312
  }
312
313
 
314
+ /**
315
+ * Get global npm prefix for module resolution.
316
+ * This helps find globally installed npm packages.
317
+ * @returns {string|null} Path to global node_modules or null if not found
318
+ */
319
+ function getGlobalNpmPrefix() {
320
+ try {
321
+ // Get npm's global prefix (where global packages are installed)
322
+ const prefix = execSync('npm config get prefix', { encoding: 'utf8' }).trim();
323
+ // Global node_modules is typically at <prefix>/lib/node_modules
324
+ const globalNodeModules = path.join(prefix, 'lib', 'node_modules');
325
+ if (fs.existsSync(globalNodeModules)) {
326
+ return globalNodeModules;
327
+ }
328
+ // Alternative location on some systems
329
+ const altGlobalNodeModules = path.join(prefix, 'node_modules');
330
+ if (fs.existsSync(altGlobalNodeModules)) {
331
+ return altGlobalNodeModules;
332
+ }
333
+ return null;
334
+ } catch (e) {
335
+ // If npm config fails, try to find it via NODE_PATH or common locations
336
+ return null;
337
+ }
338
+ }
339
+
313
340
  // Main execution
314
341
  (async () => {
315
342
  try {
343
+ // Get global npm path for module resolution
344
+ const globalNpmPath = getGlobalNpmPrefix();
345
+ const resolvePaths = [projectRoot];
346
+ if (globalNpmPath) {
347
+ resolvePaths.push(globalNpmPath);
348
+ }
349
+
316
350
  // Try to require semantic-release
317
- // First try resolving from project root (for devDependencies), then fall back to global
351
+ // First try resolving from project root (for devDependencies), then try global, then fall back to default
318
352
  let semanticRelease;
319
- try {
320
- const semanticReleasePath = require.resolve('semantic-release', { paths: [projectRoot] });
321
- semanticRelease = require(semanticReleasePath);
322
- } catch (resolveError) {
323
353
  try {
324
- semanticRelease = require('semantic-release');
325
- } catch (e) {
326
- console.error('Error: semantic-release is not installed.');
327
- console.error('Please install it with: npm install -g semantic-release');
328
- console.error('Or install it as a devDependency: npm install --save-dev semantic-release');
329
- if (isSubfolderBuild) {
330
- console.error('For subfolder builds, also install: npm install -g semantic-release-commit-filter');
331
- console.error('Or as devDependency: npm install --save-dev semantic-release-commit-filter');
354
+ const semanticReleasePath = require.resolve('semantic-release', { paths: resolvePaths });
355
+ semanticRelease = require(semanticReleasePath);
356
+ } catch (resolveError) {
357
+ try {
358
+ // Try with just global path
359
+ if (globalNpmPath) {
360
+ const semanticReleasePath = require.resolve('semantic-release', { paths: [globalNpmPath] });
361
+ semanticRelease = require(semanticReleasePath);
362
+ } else {
363
+ throw resolveError;
364
+ }
365
+ } catch (globalError) {
366
+ try {
367
+ // Final fallback: default require (should work if in NODE_PATH or default locations)
368
+ semanticRelease = require('semantic-release');
369
+ } catch (e) {
370
+ console.error('Error: semantic-release is not installed.');
371
+ console.error('Please install it with: npm install -g semantic-release');
372
+ console.error('Or install it as a devDependency: npm install --save-dev semantic-release');
373
+ if (isSubfolderBuild) {
374
+ console.error('For subfolder builds, also install: npm install -g semantic-release-commit-filter');
375
+ console.error('Or as devDependency: npm install --save-dev semantic-release-commit-filter');
376
+ }
377
+ process.exit(1);
378
+ }
332
379
  }
333
- process.exit(1);
334
380
  }
335
- }
336
381
 
337
- // For subfolder builds, require semantic-release-commit-filter
338
- // (required only to verify it's installed; the plugin is used via options.plugins)
339
- // First try resolving from project root (for devDependencies), then fall back to global
340
- if (isSubfolderBuild) {
341
- try {
342
- const commitFilterPath = require.resolve('semantic-release-commit-filter', { paths: [projectRoot] });
343
- require(commitFilterPath);
344
- } catch (resolveError) {
382
+ // For subfolder builds, require semantic-release-commit-filter
383
+ // (required only to verify it's installed; the plugin is used via options.plugins)
384
+ if (isSubfolderBuild) {
345
385
  try {
346
- require('semantic-release-commit-filter');
347
- } catch (e) {
348
- console.error('Error: semantic-release-commit-filter is not installed.');
349
- console.error('Please install it with: npm install -g semantic-release-commit-filter');
350
- console.error('Or install it as a devDependency: npm install --save-dev semantic-release-commit-filter');
351
- process.exit(1);
386
+ const commitFilterPath = require.resolve('semantic-release-commit-filter', { paths: resolvePaths });
387
+ require(commitFilterPath);
388
+ } catch (resolveError) {
389
+ try {
390
+ // Try with just global path
391
+ if (globalNpmPath) {
392
+ const commitFilterPath = require.resolve('semantic-release-commit-filter', { paths: [globalNpmPath] });
393
+ require(commitFilterPath);
394
+ } else {
395
+ throw resolveError;
396
+ }
397
+ } catch (globalError) {
398
+ try {
399
+ // Final fallback: default require
400
+ require('semantic-release-commit-filter');
401
+ } catch (e) {
402
+ console.error('Error: semantic-release-commit-filter is not installed.');
403
+ console.error('Please install it with: npm install -g semantic-release-commit-filter');
404
+ console.error('Or install it as a devDependency: npm install --save-dev semantic-release-commit-filter');
405
+ process.exit(1);
406
+ }
407
+ }
352
408
  }
353
409
  }
354
- }
355
410
 
356
411
  // Query registry for latest version if repository info is provided
357
412
  let registryVersion = null;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-package-folder
3
- Version: 4.3.0
3
+ Version: 4.3.1
4
4
  Summary: Python package to automatically package and build a folder, fetching all relevant dependencies.
5
5
  Project-URL: Repository, https://github.com/alelom/python-package-folder
6
6
  Author-email: Alessio Lombardi <work@alelom.com>
@@ -11,9 +11,9 @@ python_package_folder/subfolder_build.py,sha256=oH_KKLJIMByUZCl8y3AyohUO6Om0OvsI
11
11
  python_package_folder/types.py,sha256=3yeSRR5p_3PDKEAaehW_RJ7NwJHexOIeA08bGaT1iSY,2368
12
12
  python_package_folder/utils.py,sha256=lIkWsFKeAYAJ9TDUM99T4pUBHJVbUvCdUgkWQN-LUho,3111
13
13
  python_package_folder/version.py,sha256=kIDP6S9trEfs9gj7lBYGxrWm4RPssRla24UtlO9Jkh4,9111
14
- python_package_folder/scripts/get-next-version.cjs,sha256=5gImk8Yyg0_TZ9ZtL6hXx8lSRT4Dn_sdkDl6mynlqTs,21535
15
- python_package_folder-4.3.0.dist-info/METADATA,sha256=5SxWRMB_PR-_s3P9JaoIQmwE9Eg5srFAEwoesDziop0,37517
16
- python_package_folder-4.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
17
- python_package_folder-4.3.0.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
18
- python_package_folder-4.3.0.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
19
- python_package_folder-4.3.0.dist-info/RECORD,,
14
+ python_package_folder/scripts/get-next-version.cjs,sha256=HfRF84NsNVTaAu6cLH1B217cUACnlHm01ct2um_eQL8,23581
15
+ python_package_folder-4.3.1.dist-info/METADATA,sha256=qjHuCI2rEPrSU89n0yg6gwdII_N0fWbwIZ2ti2ApAUc,37517
16
+ python_package_folder-4.3.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
17
+ python_package_folder-4.3.1.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
18
+ python_package_folder-4.3.1.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
19
+ python_package_folder-4.3.1.dist-info/RECORD,,