Merge pull request #9092 from composer/revert-9085-lib-cldr
Revert "Allow specifying a version requirement for CLDR"pull/9098/head
commit
393acc767b
|
@ -154,14 +154,7 @@ class PlatformRepository extends ArrayRepository
|
|||
break;
|
||||
|
||||
case 'intl':
|
||||
if (class_exists('ResourceBundle', false)) {
|
||||
# Add a seperate version for the CLDR library version
|
||||
$cldrVersion = \ResourceBundle::create('root', 'ICUDATA-curr', false)->get('Version');
|
||||
$this->addLibrary('cldr', 'The unicode CLDR project', $cldrVersion);
|
||||
}
|
||||
|
||||
$name = 'icu';
|
||||
$description = 'The ICU unicode and globalization support library';
|
||||
$name = 'ICU';
|
||||
if (defined('INTL_ICU_VERSION')) {
|
||||
$prettyVersion = INTL_ICU_VERSION;
|
||||
} else {
|
||||
|
@ -235,7 +228,15 @@ class PlatformRepository extends ArrayRepository
|
|||
continue 2;
|
||||
}
|
||||
|
||||
$this->addLibrary($name, $description, $prettyVersion);
|
||||
try {
|
||||
$version = $this->versionParser->normalize($prettyVersion);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
|
||||
$lib->setDescription($description);
|
||||
$this->addPackage($lib);
|
||||
}
|
||||
|
||||
$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
|
||||
|
@ -345,22 +346,4 @@ class PlatformRepository extends ArrayRepository
|
|||
{
|
||||
return 'ext-' . str_replace(' ', '-', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param string $prettyVersion
|
||||
*/
|
||||
private function addLibrary($name, $description, $prettyVersion)
|
||||
{
|
||||
try {
|
||||
$version = $this->versionParser->normalize($prettyVersion);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
|
||||
$lib->setDescription($description);
|
||||
$this->addPackage($lib);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Test\Repository;
|
||||
|
||||
use Composer\Package\Package;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Util\Platform;
|
||||
|
@ -68,38 +67,4 @@ class PlatformRepositoryTest extends TestCase {
|
|||
$this->assertNotNull($package, 'failed to find HHVM package');
|
||||
$this->assertSame('4.0.1.0-dev', $package->getVersion());
|
||||
}
|
||||
|
||||
public function testICULibraryVersion() {
|
||||
if (!defined('INTL_ICU_VERSION')) {
|
||||
$this->markTestSkipped('Test only work with ext-intl present');
|
||||
}
|
||||
|
||||
if (!class_exists('ResourceBundle', false)) {
|
||||
$this->markTestSkipped('Test only work with ResourceBundle class present');
|
||||
}
|
||||
|
||||
$platformRepository = new PlatformRepository();
|
||||
$packages = $platformRepository->getPackages();
|
||||
|
||||
/** @var Package $icuPackage */
|
||||
$icuPackage = null;
|
||||
/** @var Package $cldrPackage */
|
||||
$cldrPackage = null;
|
||||
|
||||
foreach ($packages as $package) {
|
||||
if ($package->getName() === 'lib-icu') {
|
||||
$icuPackage = $package;
|
||||
}
|
||||
|
||||
if ($package->getName() === 'lib-cldr') {
|
||||
$cldrPackage = $package;
|
||||
}
|
||||
}
|
||||
|
||||
self::assertNotNull($icuPackage, 'Expected to find lib-icu in packages');
|
||||
self::assertNotNull($cldrPackage, 'Expected to find lib-cldr in packages');
|
||||
|
||||
self::assertSame(3, substr_count($icuPackage->getVersion(), '.'), 'Expected to find real ICU version');
|
||||
self::assertSame(3, substr_count($cldrPackage->getVersion(), '.'), 'Expected to find real CLDR version');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue