feat: make cellar structure compliant with brew
This commit is contained in:
@@ -23,8 +23,7 @@ Some packages use hard-coded path prefixes (e.g. Python).
|
|||||||
For these, you need to create a symlink:
|
For these, you need to create a symlink:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo mkdir -p /opt/homebrew
|
sudo ln -s $BREW_PY_CELLAR /opt/homebrew
|
||||||
sudo ln -s $BREW_PY_CELLAR/cellar /opt/homebrew/Cellar
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
brew.py
10
brew.py
@@ -1383,7 +1383,7 @@ class LocalPackageVersion:
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def rubyPath(self) -> str:
|
def rubyPath(self) -> str:
|
||||||
''' Returns `@/cellar/<pkg>/<version>/.brew/<pkg>.rb` '''
|
''' Returns `@/Cellar/<pkg>/<version>/.brew/<pkg>.rb` '''
|
||||||
return os.path.join(self.path, '.brew', self.pkg.name + '.rb')
|
return os.path.join(self.path, '.brew', self.pkg.name + '.rb')
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
@@ -1405,7 +1405,7 @@ class LocalPackageVersion:
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def _gatherBinaries(self) -> list[str]:
|
def _gatherBinaries(self) -> list[str]:
|
||||||
''' Binary paths in `cellar/<pkg>/<version>/bin/...` '''
|
''' Binary paths in `@/Cellar/<pkg>/<version>/bin/...` '''
|
||||||
path = os.path.join(self.path, 'bin')
|
path = os.path.join(self.path, 'bin')
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
return [x.path for x in os.scandir(path) if os.access(x, os.X_OK)]
|
return [x.path for x in os.scandir(path) if os.access(x, os.X_OK)]
|
||||||
@@ -1570,7 +1570,7 @@ class Cellar:
|
|||||||
ROOT = Env.CELLAR_PATH
|
ROOT = Env.CELLAR_PATH
|
||||||
BIN = os.path.join(ROOT, 'bin')
|
BIN = os.path.join(ROOT, 'bin')
|
||||||
CACHE = os.path.join(ROOT, 'cache')
|
CACHE = os.path.join(ROOT, 'cache')
|
||||||
CELLAR = os.path.join(ROOT, 'cellar')
|
CELLAR = os.path.join(ROOT, 'Cellar')
|
||||||
DOWNLOAD = os.path.join(ROOT, 'download')
|
DOWNLOAD = os.path.join(ROOT, 'download')
|
||||||
OPT = os.path.join(ROOT, 'opt')
|
OPT = os.path.join(ROOT, 'opt')
|
||||||
|
|
||||||
@@ -1626,7 +1626,7 @@ class Cellar:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def installPath(pkg: str) -> str:
|
def installPath(pkg: str) -> str:
|
||||||
''' Returns `@/cellar/<pkg>` '''
|
''' Returns `@/Cellar/<pkg>` '''
|
||||||
return os.path.join(Cellar.CELLAR, pkg)
|
return os.path.join(Cellar.CELLAR, pkg)
|
||||||
|
|
||||||
# Version handling
|
# Version handling
|
||||||
@@ -1686,7 +1686,7 @@ class TarPackage:
|
|||||||
self.fname = fname
|
self.fname = fname
|
||||||
|
|
||||||
def extract(self, *, dryRun: bool = False) -> 'PkgVer|None':
|
def extract(self, *, dryRun: bool = False) -> 'PkgVer|None':
|
||||||
''' Extract tar file into `@/cellar/...` '''
|
''' Extract tar file into `@/Cellar/...` '''
|
||||||
shortPath = Cellar.shortPath(self.fname)
|
shortPath = Cellar.shortPath(self.fname)
|
||||||
if shortPath.startswith('..'): # if path outside of cellar
|
if shortPath.startswith('..'): # if path outside of cellar
|
||||||
shortPath = os.path.basename(self.fname)
|
shortPath = os.path.basename(self.fname)
|
||||||
|
|||||||
Reference in New Issue
Block a user