1
0
Fork 0

Merge branch '1.6'

pull/7319/head
Jordi Boggiano 2018-05-04 11:18:18 +02:00
commit 4ebb747e12
7 changed files with 25 additions and 12 deletions

View File

@ -5,6 +5,7 @@ if (PHP_SAPI !== 'cli') {
echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}
setlocale(LC_ALL, 'C');
require __DIR__.'/../src/bootstrap.php';
use Composer\Console\Application;

View File

@ -179,6 +179,10 @@ class ClassMapGenerator
if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
$contents = substr($contents, 0, $pos);
}
// strip comments if short open tags are in the file
if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
$contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
}
preg_match_all('{
(?:

View File

@ -18,6 +18,7 @@ use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
use Composer\Util\Filesystem;
use Composer\Util\Silencer;
use Composer\Util\Platform;
/**
* Package installation manager.
@ -71,7 +72,17 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
*/
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
if (!$repo->hasPackage($package)) {
return false;
}
$installPath = $this->getInstallPath($package);
if (is_readable($installPath)) {
return true;
}
return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
}
/**

View File

@ -103,6 +103,10 @@ class Filesystem
return $this->removeJunction($directory);
}
if (is_link($directory)) {
return unlink($directory);
}
if (!file_exists($directory) || !is_dir($directory)) {
return true;
}

View File

@ -1334,10 +1334,10 @@ EOF;
file_put_contents($this->workingDir.'/forks/bar/src/exclude/FooExclClass.php', '<?php class FooExclClass {};');
$target = $this->workingDir.'/forks/bar/';
$link = $this->workingDir.'/composersrc/foo/bar/';
$link = $this->workingDir.'/composersrc/foo/bar';
$command = Platform::isWindows()
? 'mklink /j "' . str_replace('/', '\\', $link) . '" "' . str_replace('/', '\\', $target)
: 'ln -s "' . $target . '" "' . $link;
? 'mklink /j "' . str_replace('/', '\\', $link) . '" "' . str_replace('/', '\\', $target) . '"'
: 'ln -s "' . $target . '" "' . $link . '"';
exec($command);
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');

View File

@ -62,14 +62,6 @@ class ClassMapGeneratorTest extends TestCase
'ShortOpenTagDocblock' => realpath(__DIR__) . '/Fixtures/classmap/ShortOpenTagDocblock.php',
);
/**
* @wontfix If short_open_tag is not enabled, we end up parsing the docblock because
* php_strip_whitespace won't recognize the file. Funky edge-case (does not apply to HHVM).
*/
if (!defined('HHVM_VERSION') && !ini_get('short_open_tag')) {
$classmap['description'] = realpath(__DIR__) . '/Fixtures/classmap/ShortOpenTagDocblock.php';
}
$data = array(
array(__DIR__ . '/Fixtures/Namespaced', array(
'Namespaced\\Bar' => realpath(__DIR__) . '/Fixtures/Namespaced/Bar.inc',

View File

@ -2,4 +2,5 @@
/**
* Some class description here.
*/
// other class name in comment
class ShortOpenTagDocblock {}