apt-offline on Windows

4

Following this tutorial, I don't know how to reproduce step 2 on a windows machine:

apt-offline get C:\apt-offline.sig --threads 5

How do I install apt-offline on a Windows machine so I can run this command?

This is what I have tried:
I installed Python 2.7.5 on Windows and downloaded the apt-offline package.
Then I ran the setup.py script contained in the folder.
First with the build parameter and then with the install parameter as described in the INSTALL document.

The only way I can get apt-offline to work is with:

cd C:\apt-offline-1.3
python apt-offline

It never works by entering apt-offline or python apt-offline into cmd.

Christian Heinrichs

Posted 2013-09-10T14:25:28.363

Reputation: 145

How did you get to download apt-offline on windows? I can't find any download link anywhere. – Tomáš Zato - Reinstate Monica – 2014-06-19T21:40:23.777

Tell us what you've done. Have you successfully installed apt-offline on Windows? – terdon – 2013-09-10T15:11:25.780

Answers

4

That's a feature! Windows, just like *nix has a $PATH, a list of directories in which it will search for executable files when a program's name is given in the command line. If a given executable is not in one of those directories, you will need to use its path (not to be confused with $PATH) to run it.

So, you have a few choices:

  • You can add the directory in which you have saved apt-offline to your $PATH (source):

    1. From the Desktop, right-click My Computer and click Properties.
    2. Click Advanced System Settings link in the left column.
    3. In the System Properties window click the Environment Variables button.
  • You can use the complete path to run the program:

    python C:\apt-offline-1.3\apt-offline
    
  • You can change directories to C:\apt-offline-1.3\ and run it from there which is exactly what you've been doing.

terdon

Posted 2013-09-10T14:25:28.363

Reputation: 45 216

Thank you for your answer! But why do I have to run through the installation process at all as mentioned on the apt-offline GitHub page. Shouldn't this take care of integrating the command apt-offline into Windows?

– Christian Heinrichs – 2013-09-11T14:13:35.133

@codingaround apparently not. Since most things don't happen from the command line in Windows, adding a program to the PATH might not always happen. For example, windows shortcuts use absolute paths not just the program's name. The installation probably just links the program to the necessary libraries, places files in the correct folders etc. – terdon – 2013-09-11T17:21:09.680

The setup.py installed apt-offline into the site-packages folder of Python 2.7.5. Is this what you mean by "places files in the correct folders etc."? So, is there no reason to run the setup.py at all? – Christian Heinrichs – 2013-09-11T19:49:28.720

@codingaround I don't know, I'd have to read the source. Does it perhaps compile something? Collect information about your system? Set up environment variables? – terdon – 2013-09-11T19:51:09.473

The setup.py script does not seem to take care of commands at all. This answer on StackOverflow explains it, I think. While the setup script does not contain entry_point, because it's not supported in distutils, there is a line called scripts=['apt-offline', 'apt-offline-gui']

– Christian Heinrichs – 2013-09-11T20:21:33.293

I tried out all 3 of your suggested methods and 2 of them didn't work. Here is what happens if I use the first method: I added the folder containing apt-offline to $PATH, restarted cmd and ran apt-offline without success. Method 2 does only work this way: python C:\apt-offline-1.3\apt-offline. – Christian Heinrichs – 2013-09-11T23:03:14.727

@codingaround yes, sorry, that was a typo because I copy pasted, the second command was supposed to be like that. As for adding the directory to the path, I can't help you if you don't tell me the exact error message. "It did not work" is not very clear. Actually, I probably can't help you anyway since I don't really use Windows. Did you finally get it to work? Oh, and the setup.py looks more like a configuration file than an installer. – terdon – 2013-09-11T23:30:59.687

C:\apt-offline-1.3 was added to %PATH%. After this I typed apt-offline into cmd, which resulted in: The command "apt-offline" is either mistyped or does not exist. Typing python apt-offline into cmd results in: python: can't open file 'apt-offline': [Errno 2] No such file or directory – Christian Heinrichs – 2013-09-12T16:13:45.357