Track issues...
Motivation
Just want to contribute a bit back to community and also I heavily relies on conda on my environment setup. Conda compare brew it has advantage of self contains cross building environment and more control to versioning.
This post is just my tracking board in case I forgot these PR:
Problems
Neovim
Libtool Hardcoded Path
Conda build env is not reproducible
Remember conda is heavily home-folderable, it doesn't require root permission; it doesn't hardcoded path; so ...
It's not right to have these:
# Assembler program.
AS="/Users/runner/miniforge3/conda-bld/libtool_1596899629849/_build_env/bin/x86_64-apple-darwin13.4.0-as"
Note Mac's libtool is different from GNU libtool. When you brew install libtool
you are actually installing glibtool.
Therefore when you build libtool
with other environment, you get the relocation nightmare. One way to stop is to remove prefix e.g. like this for all env vars and do some post built dirty removing.
Neovim Sticked to Lua5.1
Multiversion & coexists package is hard in many pkg manager including Conda
Lua5.1 is not back compatible since 5.3. So, things get more and more sticky. Multiple PR to solve, so there's no so far a conda-forge certified nvim pkg. If you are in a hurry, please try mine: https://anaconda.org/daizeng1984/nvim
🥴I'm now dreaming neovim was written in Rust.
Fasd
Command line (bash etc.) script has conflicting requirements
The ticket is sticked to whether we should include bash in conda while conda itself is relies on bash. This is more a philosophy/belief type of argument. I realized don't have much time then and drop the conversation and later fell into new love zoxide, which is much faster and also kinds of migrating my pkg army to Nix which is more rootily powerful.
Zoxide
my z for conda
Just created the ticket and rust recipes are pretty standard...
Be guided to solve the license files for zoxide... and it goes smoothly.
When upstream version changes, I used this temporary code to update licenses:
import json, requests, tarfile, gzip, io, itertools, re, io, os
# output dir
tmp_dir = "./library_licenses"
os.makedirs(tmp_dir, exist_ok=True)
licenses = json.load(open("dependencies.json"))
licenses_and_crate={};
skipping = []
for i, l in enumerate(licenses):
name, version = l["name"], l["version"]
if name in skipping:
continue
print(name, version, f"{i+1}/{len(licenses)}")
res = requests.get(f"https://crates.io/api/v1/crates/{name}/{version}/download")
tf = tarfile.TarFile(fileobj=gzip.GzipFile(fileobj=io.BytesIO(res.content)),mode='r')
l["tarfile"] = tf
licenses_and_crate[f"{l['name']}-{l['version']}"] = l
assert len(licenses_and_crate) + len(skipping) == len(licenses)
custom={'ryu-1.0.3': 'LICENSE-APACHE', "ansi_term-0.12.1": "LICENCE", "minreq-2.1.0": "COPYING.md"}
explicit_mit_licenses = []; license_file = []; missing=[];
for k,l in licenses_and_crate.items():
tf = l["tarfile"]
files = [ti.name.split('/')[-1] for ti in tf.getmembers() if len(ti.name.split('/')) == 2]
if 'LICENSE-MIT' in files:
explicit_mit_licenses.append((f"{l['name']}",f"{l['version']}",l["license"],'LICENSE-MIT'))
else:
matches = [ f for f in files if re.match("LICENSE*",f)]
if len(matches) ==1:
license_file.append((f"{l['name']}",f"{l['version']}",l["license"],matches[0]))
else:
if k in custom:
license_file.append((f"{l['name']}",f"{l['version']}",l["license"],custom[k]))
else:
missing.append((f"{l['name']}",f"{l['version']}",l["license"],l['repository']))
manual_missing = []
exception = {"clap_derive" :
"https://raw.githubusercontent.com/clap-rs/clap/master/LICENSE-APACHE"
}
if len(missing) > 0:
for m in missing:
mname = m[3].split('.git')[0].split('/')[-2]
mgitrepo = m[3].split('.git')[0].split('/')[-1]
name = m[0]
version = m[1]
#missing_licenses = list(x.strip() for x in m[2].split("OR"))
#for ml in missing_licenses:
res = requests.get(f"https://api.github.com/repos/{mname}/{mgitrepo}/license")
mdata = res.json();
if 'download_url' in mdata:
with open(os.path.join(tmp_dir, f"{name}-{version}-license"), "wb") as f:
download_url = mdata['download_url']
res = requests.get(download_url)
f.write(res.content)
else:
if m[0] in exception:
with open(os.path.join(tmp_dir, f"{name}-{version}-license"), "wb") as f:
download_url = exception[m[0]]
res = requests.get(download_url)
f.write(res.content)
else:
manual_missing.append(m)
missing = manual_missing
print("\nmissing libray licenses:")
print("\n".join([str(l) for l in missing]))
print(f"{len(explicit_mit_licenses)} having 'LICENSE-MIT', {len(license_file)} having 'LICENSE*' or custom filename, {len(missing)} licenses are missing!!!; in total {len(licenses_and_crate)}")
for name, version, _, lic_name in itertools.chain(explicit_mit_licenses, license_file):
key = f"{name}-{version}"
tf = licenses_and_crate[key]["tarfile"]
with open(os.path.join(tmp_dir, f"{key}-license"), "wb") as f:
f.write(tf.extractfile(f"{key}/{lic_name}").read().replace(b'\r\n', b'\n'))
Direnv
How can this be missing! Let's fix that.
😆 Turns out conda-forge's go is very easy. Could feed more to conda-forge.